instance_id stringlengths 10 57 | file_changes listlengths 1 15 | repo stringlengths 7 53 | base_commit stringlengths 40 40 | problem_statement stringlengths 11 52.5k | patch stringlengths 251 7.06M |
|---|---|---|---|---|---|
PyCQA__flake8-bugbear-213 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"bugbear.py:BugBearChecker.gen_line_based_checks"
],
"edited_modules": [
"bugbear.py:BugBearChecker"
]
},
"file": "bugbear.py"
}
] | PyCQA/flake8-bugbear | 49aec1807ead4c7da7d055e20118563ed13b5201 | B950: Propose exemption for long URLs
I like the idea of using B950 over E501, but I do not want to be warned anytime I include a long URL in a comment. Breaking URLs over multiple lines is not acceptable as I want them to be clickable.
pycodestyle addresses this by making an exemption to the line length error for c... | diff --git a/.gitignore b/.gitignore
index fc8539e..1dc5815 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,6 +23,7 @@ var/
*.egg-info/
.installed.cfg
*.egg
+venv/
# PyInstaller
# Usually these files are written by a python script from a template
diff --git a/README.rst b/README.rst
index 6d94ba7..7ad3874 10064... |
PyCQA__flake8-bugbear-216 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"bugbear.py:BugBearVisitor.check_for_b018"
],
"edited_modules": [
"bugbear.py:BugBearVisitor"
]
},
"file": "bugbear.py"
}
] | PyCQA/flake8-bugbear | c0a9c878dd50b57e8f39f34b07f1730866c9d86d | B018 wrongly detects inline variable or attribute docstrings
Having an inline attribute doc string or a module variable docstring, it is wrongly marked as B018 (sample from sphinx doc):
```
module_level_variable2 = 98765
"""int: Module level variable documented inline.
The docstring may span multiple lines. The... | diff --git a/bugbear.py b/bugbear.py
index 78c2ca3..b8ecbd5 100644
--- a/bugbear.py
+++ b/bugbear.py
@@ -654,18 +654,15 @@ class BugBearVisitor(ast.NodeVisitor):
self.errors.append(B903(node.lineno, node.col_offset))
def check_for_b018(self, node):
- for index, subnode in enumerate(node.body):
+ ... |
PyCQA__flake8-bugbear-261 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"bugbear.py:BugBearChecker.should_warn"
],
"edited_modules": [
"bugbear.py:BugBearChecker"
]
},
"file": "bugbear.py"
}
] | PyCQA/flake8-bugbear | b1e4ef296ec6afb6df788d81db0953cf5fd79566 | `should_warn` is incompatible with flake8 (next)
minimal reproduction (trigger any `B9*` warning with the default settings)
```console
$ rm -rf venv && virtualenv -qq venv && venv/bin/pip install -qq git+https://github.com/pycqa/flake8 git+https://github.com/pycqa/flake8-bugbear && venv/bin/flake8 --config /dev/nul... | diff --git a/bugbear.py b/bugbear.py
index 06e598d..e47ede1 100644
--- a/bugbear.py
+++ b/bugbear.py
@@ -155,12 +155,13 @@ class BugBearChecker:
return True
for i in range(2, len(code) + 1):
- if code[:i] in self.options.select:
+ if self.options.select and code[:i] in self... |
PyCQA__flake8-bugbear-385 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"bugbear.py:BugBearVisitor.check_for_b033"
],
"edited_modules": [
"bugbear.py:BugBearVisitor"
]
},
"file": "bugbear.py"
}
] | PyCQA/flake8-bugbear | 535c109e409d93c298e72b7d707a7ea6723f0a35 | B033 should say what the duplicate set item is
I got an error `taxonomy/parsing.py:87:11: B033 Sets should not contain duplicate items. Duplicate items will be replaced with a single item at runtime.`
Now, part of this set looks like this:
```
"İ",
"À",
"Á",
"Ć"... | diff --git a/bugbear.py b/bugbear.py
index 4717a4f..eff5c58 100644
--- a/bugbear.py
+++ b/bugbear.py
@@ -1351,12 +1351,16 @@ class BugBearVisitor(ast.NodeVisitor):
self.errors.append(B032(node.lineno, node.col_offset))
def check_for_b033(self, node):
- constants = [
- item.value
- ... |
PyCQA__flake8-bugbear-424 | [
{
"changes": {
"added_entities": [
"bugbear.py:BugBearVisitor.visit_ImportFrom"
],
"added_modules": null,
"edited_entities": [
"bugbear.py:BugBearVisitor.check_for_b005",
"bugbear.py:BugBearVisitor.check_for_b017"
],
"edited_modules": [
"bugbea... | PyCQA/flake8-bugbear | 907e0dd29a99818591a604d4557c70ea33204712 | B017: False negative when "from" imports used
## Summary
B017 fails when raises is imported directly
## Version
Replicated on version `23.9.16`
## Sample code
```
import pytest
from pytest import raises
def foo():
raise
def test_pytest_raises():
with raises(Exception):
foo()
... | diff --git a/bugbear.py b/bugbear.py
index 5fbfa19..ee2afd4 100644
--- a/bugbear.py
+++ b/bugbear.py
@@ -547,6 +547,9 @@ class BugBearVisitor(ast.NodeVisitor):
self.check_for_b005(node)
self.generic_visit(node)
+ def visit_ImportFrom(self, node):
+ self.visit_Import(node)
+
def visit_... |
PyCQA__flake8-bugbear-450 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"bugbear.py:ExceptBaseExceptionVisitor.visit_Raise"
],
"edited_modules": [
"bugbear.py:ExceptBaseExceptionVisitor"
]
},
"file": "bugbear.py"
}
] | PyCQA/flake8-bugbear | 9fe5ca3bc345b2b2f861fd66f6d7063b4e1720d3 | Error in latest version of flake8-bugbear 24.1.15
Getting error with latest version of flake8-bugbear
```
Traceback (most recent call last):
File "/usr/local/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/usr/local/lib/python3.10/site-packages/fla... | diff --git a/README.rst b/README.rst
index 45acc66..524472f 100644
--- a/README.rst
+++ b/README.rst
@@ -349,6 +349,12 @@ MIT
Change Log
----------
+Unreleased
+~~~~~~~~~~
+
+* B036: Fix crash on `raise` statements raising something other than
+ a bare name (#450)
+
24.1.15
~~~~~~~
diff --git a/bugbear.py b/bu... |
PyCQA__isort-1995 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"isort/settings.py:_get_config_data"
],
"edited_modules": [
"isort/settings.py:_get_config_data"
]
},
"file": "isort/settings.py"
}
] | PyCQA/isort | 4e3ccb1c635badad59fb0dd95ef8923a95390f21 | Do not cache configuration files
isort can run in long processes when used in an editor. In that
scenario users might edit their configuration files and literally
save a file again to see its outcome.
This is not possible right now because we `lru_cache()` all the
relevant functions in `settings.py`.
I... | diff --git a/isort/settings.py b/isort/settings.py
index fb9bba2f..24de2337 100644
--- a/isort/settings.py
+++ b/isort/settings.py
@@ -11,7 +11,6 @@ import stat
import subprocess # nosec: Needed for gitignore support.
import sys
from dataclasses import dataclass, field
-from functools import lru_cache
from pathlib... |
PyCQA__isort-2184 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"isort/parse.py:file_contents"
],
"edited_modules": [
"isort/parse.py:file_contents"
]
},
"file": "isort/parse.py"
},
{
"changes": {
"added_entities": null... | PyCQA/isort | 9255bcae69aef671f281aa29a7159dd7b840b3d5 | isort introduces SyntaxError with multiline "from a import b as c" plus a comment ending in a parenthesis
```
% cat frimp.py
from a import (
b as c, # comment that is long enough that this import doesn't fit in one line (parens)
)
% isort --diff frimp.py --profile=black
--- /Users/jelle/py/tmp/frimp.py:befo... | diff --git a/isort/parse.py b/isort/parse.py
index 7dfd7cef..2c3c41ef 100644
--- a/isort/parse.py
+++ b/isort/parse.py
@@ -519,7 +519,11 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
if comments and attach_comments_to is not None:
attach_commen... |
PyCQA__isort-2191 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"isort/identify.py:imports"
],
"edited_modules": [
"isort/identify.py:imports"
]
},
"file": "isort/identify.py"
},
{
"changes": {
"added_entities": [
... | PyCQA/isort | 9f7e0e51c6ab6c58695cdd3151fb886e287a67bd | Unrecoverable exception with `` from ..import ccc``
Hello,
I got ` ERROR: Unrecoverable exception thrown when parsing ./aaa/bbb/ccc.py! This should NEVER happen.`
~~~bash
$ python --version
Python 3.11.4
$ isort --version
_ _
(_) ___ ___ _ __| |_
... | diff --git a/isort/identify.py b/isort/identify.py
index e45fcb39..8223e256 100644
--- a/isort/identify.py
+++ b/isort/identify.py
@@ -5,7 +5,7 @@ from functools import partial
from pathlib import Path
from typing import Iterator, NamedTuple, Optional, TextIO, Tuple
-from isort.parse import _normalize_line, _strip_... |
PyCQA__isort-2283 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"isort/core.py:process"
],
"edited_modules": [
"isort/core.py:process"
]
},
"file": "isort/core.py"
}
] | PyCQA/isort | 7de182933fd50e04a7c47cc8be75a6547754b19c | BUG: --sort-reexports don't work with multiple lines __all__
```python
import datetime
from mylib import (
module1,
module2,
module3,
module4,
)
__all__ = (
"func1",
"func2",
"func3",
"func4",
)
```
after using `isort file.py --sort-reexports`, becomes:
```python
i... | diff --git a/isort/core.py b/isort/core.py
index 10103854..472d914d 100644
--- a/isort/core.py
+++ b/isort/core.py
@@ -27,6 +27,8 @@ CODE_SORT_COMMENTS = (
LITERAL_TYPE_MAPPING = {"(": "tuple", "[": "list", "{": "set"}
+# Ignore DeepSource cyclomatic complexity check for this function.
+# skipcq: PY-R1000
def pro... |
PyCQA__mccabe-38 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"mccabe.py:PathGraphingAstVisitor"
]
},
"file": "mccabe.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_... | PyCQA/mccabe | c9bb16e5c66997153e0347ab5a1ee39e7d2a2e76 | Not working with python 3.5 "async def ..."
It looks like mccabe is ignoring python 3.5 coroutines defined like
```python
async def foobar(a, b, c):
whatever(a, b, c)
```
I tried it via flake8 version:
2.5.1 (pep8: 1.7.0, pyflakes: 1.0.0, mccabe: 0.3.1) CPython 3.5.0+ on Linux | diff --git a/mccabe.py b/mccabe.py
index f5ef5d9..72b8bdd 100644
--- a/mccabe.py
+++ b/mccabe.py
@@ -133,6 +133,8 @@ class PathGraphingAstVisitor(ASTVisitor):
self.graphs["%s%s" % (self.classname, node.name)] = self.graph
self.reset()
+ visitAsyncFunctionDef = visitFunctionDef
+
def ... |
PyCQA__mccabe-47 | [
{
"changes": {
"added_entities": [
"mccabe.py:PathGraphingAstVisitor.default"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"mccabe.py:PathGraphingAstVisitor"
]
},
"file": "mccabe.py"
}
] | PyCQA/mccabe | 682145a37fee41fe7b6640244faa0c3f58e3b496 | Trivial function with docstring reports complexity of 2
```python
def f():
"""hi"""
x = 1
def g():
"""hi"""
```
```
$ python3.5 mccabe.py test.py
1:0: 'f' 1
6:0: 'g' 2
```
```
$ git rev-parse HEAD
682145a37fee41fe7b6640244faa0c3f58e3b496
``` | diff --git a/mccabe.py b/mccabe.py
index 305fb94..c604c1d 100644
--- a/mccabe.py
+++ b/mccabe.py
@@ -160,10 +160,11 @@ class PathGraphingAstVisitor(ASTVisitor):
name = "Stmt %d" % lineno
self.appendPathNode(name)
- visitAssert = visitAssign = visitAugAssign = visitDelete = visitPrint = \
- ... |
PyCQA__pycodestyle-499 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "pep8.py"
}
] | PyCQA/pycodestyle | eae54ff0e4c50ccc4507e95a2f8689fefb89e70e | Update handling of breaking around binary operators: W503 vs W504
Based on the discussion that started on python-dev [1] and ended with an update to PEP-8 [2][3], the logic for allowing (preferring really) breaks to occur before rather than after binary operators.
[1] https://mail.python.org/pipermail/python-ideas/201... | diff --git a/docs/intro.rst b/docs/intro.rst
index e26daf7..2ce1eb6 100644
--- a/docs/intro.rst
+++ b/docs/intro.rst
@@ -392,7 +392,7 @@ This is the current list of error and warning codes:
+------------+----------------------------------------------------------------------+
| **W5** | *Line break warning* ... |
PyCQA__pyflakes-273 | [
{
"changes": {
"added_entities": [
"pyflakes/api.py:isPythonFile"
],
"added_modules": [
"pyflakes/api.py:isPythonFile"
],
"edited_entities": [
"pyflakes/api.py:iterSourceCode"
],
"edited_modules": [
"pyflakes/api.py:iterSourceCode"
... | PyCQA/pyflakes | 1af4f14ad4675bf5c61c47bbb7c2421b50d1cba4 | Support Python 3.7
*I'm moving https://github.com/PyCQA/pyflakes/pull/90#issuecomment-301317699 here since we have GitHub issue support now.*
It looks like the [CPython 3.7 failure](https://travis-ci.org/PyCQA/pyflakes/jobs/231571260) is related to a change in the AST. The docstring is no longer in `node.body`.
h... | diff --git a/.travis.yml b/.travis.yml
index 1ea3e20..2d614cd 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,9 +11,6 @@ python:
- pypy-5.3
- pypy3
- pypy3.3-5.2-alpha1
-matrix:
- allow_failures:
- - python: nightly
install:
- pip install flake8==2.1.0 pep8==1.5.6
- python setup.py install
diff --... |
PyCQA__pyflakes-275 | [
{
"changes": {
"added_entities": [
"pyflakes/api.py:isPythonFile"
],
"added_modules": [
"pyflakes/api.py:isPythonFile"
],
"edited_entities": [
"pyflakes/api.py:iterSourceCode"
],
"edited_modules": [
"pyflakes/api.py:iterSourceCode"
... | PyCQA/pyflakes | 1af4f14ad4675bf5c61c47bbb7c2421b50d1cba4 | Please also check python scripts that are not named *.py
*Original report by [morph-debian](https://launchpad.net/~morph-debian) on [Launchpad](https://bugs.launchpad.net/bugs/970465):*
------------------------------------
Hello,
as reported on Debian at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=653890:
"""
... | diff --git a/README.rst b/README.rst
index e84d334..aeb15f9 100644
--- a/README.rst
+++ b/README.rst
@@ -72,7 +72,7 @@ rebase your commits for you.
All changes should include tests and pass flake8_.
-.. image:: https://api.travis-ci.org/PyCQA/pyflakes.svg
+.. image:: https://api.travis-ci.org/PyCQA/pyflakes.svg?br... |
PyCQA__pyflakes-313 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:Checker.handleAnnotation"
],
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.LAMBDA",
"pyflakes/checker.py:Checker.ANNASSIGN"
],
"edited_modules": [
"pyflakes/chec... | PyCQA/pyflakes | 8d0f995dafda7105a6966057fd11383f1ea6fb71 | Typing.TYPE_CHECKING imports raise F401
```
$ pip install flake8
```
```
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from my_module.test_class import MyClass
object: 'MyClass' = None
```
Flake 8 gives the following error in this scenario:
`my_module\test_class.py:4:5: F401 'my_module.test_... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index d8f093a..a070822 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -922,6 +922,39 @@ class Checker(object):
self.popScope()
self.scopeStack = saved_stack
+ def handleAnnotation(self, annotation, node):
+ if isinstance... |
PyCQA__pyflakes-322 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/api.py:checkPath",
"pyflakes/api.py:isPythonFile"
],
"edited_modules": [
"pyflakes/api.py:checkPath",
"pyflakes/api.py:isPythonFile"
]
},
"file... | PyCQA/pyflakes | 8a1feac08dae2478e3f67ab4018af86ff4ec56f0 | Drop support for EOL Python versions?
I'd like to suggest pyflakes only supports non-EOL Python versions.
Python 2.5, 2.6, 3.2 and 3.3 are EOL and no longer receive security updates.

https://github.com... | diff --git a/.appveyor.yml b/.appveyor.yml
index 41b1dbb..8a62cf8 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -13,18 +13,21 @@ install:
- ps: 7z x pypy2-v5.3.1-win32.zip | Out-Null
- move pypy2-v5.3.1-win32 C:\
- - ps: (New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pyp... |
PyCQA__pyflakes-325 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.handleNodeLoad"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 8a1feac08dae2478e3f67ab4018af86ff4ec56f0 | On Python 3, __class__ can be used without self
*Original report by [icordasc](https://launchpad.net/~icordasc) (@sigmavirus24?) on [Launchpad](https://bugs.launchpad.net/bugs/1487725):*
------------------------------------
On Python 3, the following code raises a warning:
```python
class Test(object):
d... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index baef833..9b39e6c 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -710,10 +710,14 @@ class Checker(object):
# try enclosing function scopes and global scope
for scope in self.scopeStack[-1::-1]:
- # only generators ... |
PyCQA__pyflakes-335 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:FunctionScope.unusedAssignments"
],
"edited_modules": [
"pyflakes/checker.py:FunctionScope"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 4b2d720d86a9ece3115929bef90fb19b29bf160b | Ignore "_" vars in "Unused Variable" check
*Original report by [archardlias](https://launchpad.net/~archardlias) on [Launchpad](https://bugs.launchpad.net/bugs/1328169):*
------------------------------------
Would it be possible to ignore variables named "_" from "Unused Variable" checks?
I'm not really sure whethe... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index bd5eba5..648a224 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -425,7 +425,9 @@ class FunctionScope(Scope):
Return a generator for the assignments which have not been used.
"""
for name, binding in self.items():
- ... |
PyCQA__pyflakes-371 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:is_typing_overload"
],
"added_modules": [
"pyflakes/checker.py:is_typing_overload"
],
"edited_entities": [
"pyflakes/checker.py:Checker.addBinding"
],
"edited_modules": [
"pyflakes/c... | PyCQA/pyflakes | 60c3b35769984534e2ad03d76637357818fe0112 | F811 (redefinition of unused variable) incorrectly triggered with @overload decorator
PEP 484 [introduced](https://www.python.org/dev/peps/pep-0484/#function-method-overloading) the `@overload` decorator for type annotations.
> [...] a series of `@overload`-decorated definitions must be followed by exactly one non-@... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index f520325..ad25b5e 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -495,6 +495,28 @@ def getNodeName(node):
return node.name
+def is_typing_overload(value, scope):
+ def is_typing_overload_decorator(node):
+ return (
+ ... |
PyCQA__pyflakes-396 | [
{
"changes": {
"added_entities": [
"pyflakes/api.py:_get_version"
],
"added_modules": [
"pyflakes/api.py:_get_version"
],
"edited_entities": [
"pyflakes/api.py:checkPath",
"pyflakes/api.py:main"
],
"edited_modules": [
"pyflakes/ap... | PyCQA/pyflakes | 6ee966df7e1973771f578bb6d5d041785a0685ec | undefined name '__annotations__' when use __annotations__ in module level
Environment:
- Python==3.7.1
- pyflakes==2.0.0
When using pyflake to check following code:
```Python3
# t.py
a: int = 2
print(__annotations__)
```
It will reported that
```
t.py:3: undefined name '__annotations__'
```
About `... | diff --git a/pyflakes/api.py b/pyflakes/api.py
index 805a886..3ddb386 100644
--- a/pyflakes/api.py
+++ b/pyflakes/api.py
@@ -5,6 +5,7 @@ from __future__ import with_statement
import sys
import os
+import platform
import re
import _ast
@@ -91,9 +92,6 @@ def checkPath(filename, reporter=None):
try:
... |
PyCQA__pyflakes-400 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/api.py:check"
],
"edited_modules": [
"pyflakes/api.py:check"
]
},
"file": "pyflakes/api.py"
},
{
"changes": {
"added_entities": [
"pyflak... | PyCQA/pyflakes | 009f4e7c21890cefafe5858aa682a7e7f17d6a80 | Detect type hint comments: PEP484
*Original report by [w-thomas-q](https://launchpad.net/~w-thomas-q) on [Launchpad](https://bugs.launchpad.net/bugs/1587170):*
------------------------------------
Hi,
thanks for this really great tool!
One issues I stumbled upon was that type hints seem to be ignored / not detected... | diff --git a/.appveyor.yml b/.appveyor.yml
index 5739e3b..f7d7aa2 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -44,5 +44,5 @@ build: off
test_script:
- python -m tox
-# - C:\pypy3-v5.10.0-win32\pypy3 setup.py test -q
- - C:\pypy-2.6.1-win32\pypy setup.py test -q
+# - C:\pypy3-v5.10.0-win32\pypy3 -m unitte... |
PyCQA__pyflakes-410 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.getDocstring"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | f1444872d7e4abfe1359778bca56ad3fd59a6f9b | crash: AttributeError: 'Module' object has no attribute 'parent'
9dd73ec54411a563410872b47e76f0f89f34ecfe seems to introduce a bug that causes pyflakes to crash on this code:
```python3
class foo:
pass
async def func(foo: foo):
pass
```
**backtrace:**
```
$ venv/bin/pyflakes foo.py ... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 3c4fa0f..e94bc71 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -20,6 +20,7 @@ from pyflakes import messages
PY2 = sys.version_info < (3, 0)
PY35_PLUS = sys.version_info >= (3, 5) # Python 3.5 and above
PY36_PLUS = sys.version_info >= (3,... |
PyCQA__pyflakes-420 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:DummyNode.__init__"
],
"added_modules": [
"pyflakes/checker.py:DummyNode"
],
"edited_entities": [
"pyflakes/checker.py:Checker._handle_type_comments"
],
"edited_modules": [
"pyflakes... | PyCQA/pyflakes | 2c29431eaeb9c5b681f1615bf568fc68c6469486 | Incorrect line number for syntax error in type comment
Minor issue, pyflakes 2.1.0 (macOS High Sierra and Ubuntu Xenial) is reporting an issue at line 196 when it's really at line 208. Pyflakes 2.0.0 did not report the issue at all.
To reproduce:
```console
$ pip install -U pyflakes
Requirement already up-to-da... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 70aaff2..4c88af2 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -507,6 +507,13 @@ class DoctestScope(ModuleScope):
"""Scope for a doctest."""
+class DummyNode(object):
+ """Used in place of an `ast.AST` to set error message position... |
PyCQA__pyflakes-423 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:is_typing_overload"
],
"edited_modules": [
"pyflakes/checker.py:is_typing_overload"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 4bc1f21df9d96b5dd1f5f3e213255b27f7104919 | 2.1.0 is broken
https://travis-ci.org/borgbackup/borg/jobs/486513787 | diff --git a/.appveyor.yml b/.appveyor.yml
index f7d7aa2..0e05ec3 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,8 +1,6 @@
# To activate, change the Appveyor settings to use `.appveyor.yml`.
install:
- - ps: "[Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12"
-
- - python ... |
PyCQA__pyflakes-435 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:is_typing_overload",
"pyflakes/checker.py:Checker.addBinding"
],
"edited_modules": [
"pyflakes/checker.py:is_typing_overload",
"pyflakes/checker.p... | PyCQA/pyflakes | 6ba3f8e0b59b8fe880345be7ae594ccd76661f6d | F811 (redefinition of unused variable) incorrectly triggered with @overload decorator
This bug was fixed for functions in #320. It still occurs if the function is inside a class and/or has multiple decorators (e.g. @staticmethod, @classmethod):
```python
from typing import overload
class test:
@overload
... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 4c88af2..0e636c1 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -530,14 +530,21 @@ def getNodeName(node):
return node.name
-def is_typing_overload(value, scope):
+def is_typing_overload(value, scope_stack):
+ def name_is_typing_... |
PyCQA__pyflakes-443 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "pyflakes/__init__.py"
},
{
"changes": {
"added_entities": [
"pyflakes/checker.py:_must_match",
"pyflakes/checker.py:parse_percen... | PyCQA/pyflakes | 4a807d45f9dd47266c82035bf6e04508a77f0258 | Detect broken string templates that will raise ValueError when interpolated
*Original report by [jkakar](https://launchpad.net/~jkakar) (@jkakar?) on [Launchpad](https://bugs.launchpad.net/bugs/950369):*
------------------------------------
For example, code like this will break:
>>> "%(foo)" % {"foo": "bar"}
T... | diff --git a/NEWS.rst b/NEWS.rst
index 8bf9023..993a545 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,3 +1,7 @@
+2.1.1 (2019-02-28)
+- Fix reported line number for type comment errors
+- Fix typing.overload check to only check imported names
+
2.1.0 (2019-01-23)
- Allow intentional assignment to variables named ``_``
... |
PyCQA__pyflakes-448 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.LAMBDA"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 0b163640274b15b74ac9a650cf24439b0205fc76 | Class-level `TypeVar` resulting in "undefined name" error
Minimal sample:
```
from typing import TypeVar
class IdClass:
Y = TypeVar('Y')
def id(self, x: Y) -> Y:
return x
```
Result:
```
# pyflakes t.py
t.py:7: undefined name 'Y'
```
MyPy supports such typing annotations and does n... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 0e636c1..83f92aa 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1480,7 +1480,7 @@ class Checker(object):
self.pushScope()
- self.handleChildren(node, omit='decorator_list')
+ self.handleChildren(node, omi... |
PyCQA__pyflakes-451 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "pyflakes/__init__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checke... | PyCQA/pyflakes | 4a807d45f9dd47266c82035bf6e04508a77f0258 | Link to NEWS.rst in README file should be absolute
Link to NEWS.rst file in README.rst section is provided as relative - which of course behaves correctly on github page, but not on [PyPI](https://pypi.org/project/pyflakes/) website. | diff --git a/NEWS.rst b/NEWS.rst
index 8bf9023..993a545 100644
--- a/NEWS.rst
+++ b/NEWS.rst
@@ -1,3 +1,7 @@
+2.1.1 (2019-02-28)
+- Fix reported line number for type comment errors
+- Fix typing.overload check to only check imported names
+
2.1.0 (2019-01-23)
- Allow intentional assignment to variables named ``_``
... |
PyCQA__pyflakes-452 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.handleDoctests"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 4a807d45f9dd47266c82035bf6e04508a77f0258 | 2.1.0: PYFLAKES_DOCTEST=1 causes stacktrace: AttributeError: 'NoneType' object has no attribute 'parent'
From https://gitlab.com/pycqa/flake8/issues/492
```console
$ pyflakes --version
2.1.0 Python 3.6.7 on Linux
```
```python
import foo as _
def x():
"""doc
>>> x()
>>> x()
"""
```
... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 83f92aa..86cfd11 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1162,7 +1162,8 @@ class Checker(object):
self.scopeStack = [self.scopeStack[0]]
node_offset = self.offset or (0, 0)
self.pushScope(DoctestScope)
- ... |
PyCQA__pyflakes-472 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:is_typing_overload"
],
"edited_modules": [
"pyflakes/checker.py:is_typing_overload"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 5ed30a6b9e4b9c1bb4042e5c5b3b506e52133da4 | @overload of async functions
Since #435, pyflakes git tip copes with synchronous @overload'ed functions, but not with async ones:
```python
from typing import overload
@overload
def f(x: int) -> int:
...
@overload
def f(x: float) -> float:
...
def f(x):
return x
@overload
async def g(x... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 44c6b25..eca2002 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -72,9 +72,11 @@ else:
if PY35_PLUS:
FOR_TYPES = (ast.For, ast.AsyncFor)
LOOP_TYPES = (ast.While, ast.For, ast.AsyncFor)
+ FUNCTION_TYPES = (ast.FunctionDef, ast.Async... |
PyCQA__pyflakes-479 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:_is_typing",
"pyflakes/checker.py:in_annotation",
"pyflakes/checker.py:Checker._unknown_handler",
"pyflakes/checker.py:Checker.SUBSCRIPT",
"pyflakes/checker.py:Checker.STR"
],
"added_modules": [
... | PyCQA/pyflakes | be88036019005b769596ca82fb7b82dfdffdca0f | Spurious import warning for type used in nested quoted annotation
This is similar to #290 and #313, but seems to still be an issue.
If you import a type and then use it only within a type annotation which includes a nested quoted part, then `pyflakes` reports the import as unused.
``` python
from queue import Qu... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index d157008..c89d6fb 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -618,40 +618,55 @@ def getNodeName(node):
return node.name
-def is_typing_overload(value, scope_stack):
- def name_is_typing_overload(name): # type: (str) -> bool
... |
PyCQA__pyflakes-484 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:_is_singleton",
"pyflakes/checker.py:_is_tuple_constant",
"pyflakes/checker.py:_is_constant",
"pyflakes/checker.py:_is_const_non_singleton",
"pyflakes/checker.py:_is_typing",
"pyflakes/checker.py:in_ann... | PyCQA/pyflakes | ffe938667e03b02ab8c1dfad98d30998e7d712ec | python 3.8 SyntaxWarning: "is" with a literal. Did you mean "=="?
Hi there -
I searched a bit for this but couldn't find it. This is a warning generated by Python 3.8 and I think it's new. It's very hard to get pytest to raise for this, so it would be better if it were in pyflakes / flake8.
demo:
```
"""te... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index eca2002..351ab12 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -78,6 +78,51 @@ else:
LOOP_TYPES = (ast.While, ast.For)
FUNCTION_TYPES = (ast.FunctionDef,)
+
+if PY38_PLUS:
+ def _is_singleton(node): # type: (ast.AST) -> bool
+ ... |
PyCQA__pyflakes-508 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.LAMBDA"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 1911c203a13826d2eb03d582d60874b91e36f4fc | F401 (imported but unused) false positive on Foo when using def x(a: Foo, /, *, b: Bar)
```python
from datetime import datetime as Foo, time as Bar
def x(a: Foo, /, *, b: Bar):
pass
```
Running this on the file results in:
```
› flake8 --version
3.7.9 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: ... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index c8ccf56..d157008 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1799,6 +1799,10 @@ class Checker(object):
addArgs(node.args.args)
defaults = node.args.defaults
else:
+ if PY38_PLUS:
+ ... |
PyCQA__pyflakes-516 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/api.py:main"
],
"edited_modules": [
"pyflakes/api.py:main"
]
},
"file": "pyflakes/api.py"
},
{
"changes": {
"added_entities": [
"pyflakes... | PyCQA/pyflakes | 0af480e3351ae40b4ae7f3ce7272a46fd4265dbd | Spurious unsued import warning for type annotation used in quoted cast
Given
``` python
# demo.py
from typing import Union, cast
x = cast('Union[str, int]', 42)
reveal_type(x)
```
Then I would hope that `pyflakes` would be able to see the usage of `Union` in the quoted cast, but it can't.
``` shell
$ pyflak... | diff --git a/pyflakes/api.py b/pyflakes/api.py
index 50e8ad8..ec3ef5a 100644
--- a/pyflakes/api.py
+++ b/pyflakes/api.py
@@ -193,14 +193,18 @@ def _get_version():
def main(prog=None, args=None):
"""Entry point for the script "pyflakes"."""
- import optparse
+ import argparse
# Handle "Keyboard Inte... |
PyCQA__pyflakes-535 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:in_string_annotation",
"pyflakes/checker.py:Checker._in_postponed_annotation"
],
"added_modules": [
"pyflakes/checker.py:Annotation",
"pyflakes/checker.py:AnnotationState",
"pyflakes/checker.py:in_s... | PyCQA/pyflakes | e83d920aafa92df9bda7dad606d401dda1ba722d | Undefined name when using variable annotations
Please consider the following file:
```python
Type: object
def foo(x: Type) -> None: ...
```
When checking it with '2.1.1 Python 3.8.0 on Linux' (or Python 3.7.3) I get the following error:
```
foo.py:2: undefined name 'Type'
```
This is problematic when c... | diff --git a/.appveyor.yml b/.appveyor.yml
index 1738253..2d907d6 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -2,12 +2,12 @@
install:
- python -m pip install --upgrade tox virtualenv
- - ps: (New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.1.1-win32.zip', "$env:... |
PyCQA__pyflakes-544 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:ExportBinding.__init__"
],
"edited_modules": [
"pyflakes/checker.py:ExportBinding"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | cd261abfe4cf7fcdaac5cef657ae3a16205fa0d7 | F822 (flake8): assigning result of adding tuples with wrong names to `__all__` doesn't warn
This properly warns (`example.py:4:1: F822 undefined name 'Test2' in __all__`):
```py
Test1 = "Test1"
__all__ = ("Test1",)
__all__ += ("Test2",)
```
And this doesn't:
```py
Test1 = "Test1"
__all__ = ("Test1",) + ("T... | diff --git a/.appveyor.yml b/.appveyor.yml
index 1738253..2d907d6 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -2,12 +2,12 @@
install:
- python -m pip install --upgrade tox virtualenv
- - ps: (New-Object Net.WebClient).DownloadFile('https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.1.1-win32.zip', "$env:... |
PyCQA__pyflakes-580 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:_is_name_or_attr"
],
"added_modules": [
"pyflakes/checker.py:_is_name_or_attr"
],
"edited_entities": [
"pyflakes/checker.py:Checker.SUBSCRIPT"
],
"edited_modules": [
"pyflakes/checke... | PyCQA/pyflakes | 5fc37cbda5bf4e5afcb64c45caa62062979256b4 | syntax error in forward annotation when using Annotated
When using [`Annotated`](https://www.python.org/dev/peps/pep-0593/) with string annotations the following error is raised:
```
./pyflakes.py:3:16 syntax error in forward annotation '>1'
```
Triggering code:
```
from typing import Annotated
Annotated... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 16c783f..a6439d6 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -128,6 +128,13 @@ def _is_const_non_singleton(node): # type: (ast.AST) -> bool
return _is_constant(node) and not _is_singleton(node)
+def _is_name_or_attr(node, name): #... |
PyCQA__pyflakes-604 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.checkDeadScopes",
"pyflakes/checker.py:Checker.CALL"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/che... | PyCQA/pyflakes | 0e4194b238ffd006441f1a33373062d9c7272d0e | "undefined name in __all__" has non-deterministic ordering
Found this while putting together a tool to look for regressions in the latest release and noticed that this produces things out-of-order!
```console
$ cat t.py
__all__ = ('a', 'b', 'c', 'd')
$ python3 -m pyflakes t.py
t.py:1:1 undefined name 'a' in __a... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 0d65506..38f8f73 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -992,7 +992,10 @@ class Checker(object):
if all_binding:
all_names = set(all_binding.names)
- undefined = all_names.difference(scope)... |
PyCQA__pyflakes-606 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.addBinding"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 650efb92fd27ae60ec08a70f2ac1afbea37ac3e3 | Odd edge-case regression in type annotated `__all__`
I'm not quite sure how to approach fixing this -- it regressed as part of #535 -- CC @srittau
Here's a simplified example, this is boiled down from numpy's `numpy/typing/__init__.py`
```python
from typing import TYPE_CHECKING, List
from y import z
if no... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 38f8f73..215bd31 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1140,7 +1140,10 @@ class Checker(object):
# then assume the rebound name is used as a global or within a loop
value.used = self.scope[value.name].used
... |
PyCQA__pyflakes-609 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.CALL"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 43541ee1dd394ec4691625e7295f701b3b073dca | Nested TypedDict not supported
Flake8 returns strange `undefined name` errors when using nested [alternative syntax style](https://www.python.org/dev/peps/pep-0589/#alternative-syntax) `TypedDict` declarations.
Example:
```py
from typing import TypedDict
class Example(TypedDict):
nested: TypedDict("Nes... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 215bd31..01bcf50 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1678,28 +1678,79 @@ class Checker(object):
):
self._handle_string_dot_format(node)
+ omit = []
+ annotated = []
+ not_annotated = []
+... |
PyCQA__pyflakes-619 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:Annotation.redefines"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"pyflakes/checker.py:Annotation"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 40e6dc23a8fc48f814e0c81fdcd936321ab9c023 | F811 incorrectly raised for type annotation of imported variable
The following piece of code raises F811 error in pyflakes 2.3.0:
```python
from django.core.files.storage import default_storage
default_storage: Storage
file_path = os.path.join(constants.FILE_FIELD_UPLOAD_DIR_NAME, value.name... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 01bcf50..48d3841 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -548,6 +548,10 @@ class Annotation(Binding):
annotation.
"""
+ def redefines(self, other):
+ """An Annotation doesn't define any name, so it cannot redefine o... |
PyCQA__pyflakes-632 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:Checker._match_target"
],
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:iter_child_nodes",
"pyflakes/checker.py:getNodeName",
"pyflakes/checker.py:_is_typing_helper",
"pyfla... | PyCQA/pyflakes | 95fe313ba5ca384041472cd171ea60fad910c207 | `typing.Literal` is not detected when renamed at import time
I just encountered a false-positive regression reported by PyFlakes 2.2.0, but not 2.1.1: If the *Literal* class from `typing` or `typing_extensions` is renamed at import time, PyFlakes looses track of it and treats any string argument as forward-reference th... | diff --git a/README.rst b/README.rst
index c456d25..47ea7ed 100644
--- a/README.rst
+++ b/README.rst
@@ -39,8 +39,7 @@ Design Principles
Pyflakes makes a simple promise: it will never complain about style,
and it will try very, very hard to never emit false positives.
-Pyflakes is also faster than Pylint_
-or Pyche... |
PyCQA__pyflakes-668 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:FunctionScope.unused_assignments",
"pyflakes/checker.py:FunctionScope.unused_annotations"
],
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:FunctionScope.unusedAssignments",
"pyflake... | PyCQA/pyflakes | 4dcd92e45efeb0615ba1c96d45241a037d30abe0 | Is an unused variable annotation able to be detected?
Given this sample file:
```python
def foo():
a = 10
b: str
return 1
foo()
```
It correctly gives an error about the variable `a`: `test.py:2:5 local variable 'a' is assigned to but never used`
It would be nice if an error could be give... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 56fc3ca..89c9d0a 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -588,7 +588,7 @@ class FunctionScope(Scope):
self.returnValue = None # First non-empty return
self.isGenerator = False # Detect a generator
- def unus... |
PyCQA__pyflakes-675 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.handleNodeStore"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | dbb18432165bdc567e015511b3f3284f0f14cf05 | Internal error on `__all__, = ...`
Steps to reproduce:
1. Install `pyflakes==2.4.0`
2. Create a file with the name of `foo.py`
3. Place the following in the file (the comma after `__all__` is intentional):
```py
__all__, = (
"fizz",
"buzz",
)
```
4. Run `pyflakes foo.py`
Outcome:
```
Traceback (m... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 45c7a4a..45f2a42 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1291,7 +1291,14 @@ class Checker(object):
parent_stmt != node._pyflakes_parent and
not self.isLiteralTupleUnpacking(parent_stmt)):
b... |
PyCQA__pyflakes-698 | [
{
"changes": {
"added_entities": null,
"added_modules": [
"pyflakes/checker.py:NamedExprAssignment"
],
"edited_entities": [
"pyflakes/checker.py:Checker.addBinding",
"pyflakes/checker.py:Checker.handleNodeStore"
],
"edited_modules": [
"pyflakes... | PyCQA/pyflakes | dd446ed156837f50a06596ec79efc292e856954f | assignment expression in comprehension should target outer scope
Please consider the following example, which finds the first String in a list that contains the Substring "OH":
```
list = ["STEVE", "JOHN", "YOANN"]
pattern = re.compile(".*%s.*" % "OH")
word = ""
if any((match := pattern.match(item)) for item i... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 7f33d6a..0c3f66e 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -540,6 +540,12 @@ class Assignment(Binding):
"""
+class NamedExprAssignment(Assignment):
+ """
+ Represents binding a name with an assignment expression.
+ """
+
... |
PyCQA__pyflakes-729 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.ANNASSIGN"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 7d6479e46f8f3e9607c9ef7975cc892db023d413 | annotated variable hides "undefined name"
this works:
```console
$ pyflakes /dev/stdin <<< 'x = x'
/dev/stdin:1:5: undefined name 'x'
$
```
this does not:
```console
$ pyflakes /dev/stdin <<< 'x: int = x'
$
``` | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index ae15621..56fc3ca 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -2265,7 +2265,6 @@ class Checker:
self.scope[node.name] = prev_definition
def ANNASSIGN(self, node):
- self.handleNode(node.target, node)
self.h... |
PyCQA__pyflakes-745 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.handleNodeLoad",
"pyflakes/checker.py:Checker.NAME",
"pyflakes/checker.py:Checker.AUGASSIGN"
],
"edited_modules": [
"pyflakes/checker.py:C... | PyCQA/pyflakes | 2c64ae48e2b1984a16cf25d215c9f9d21146426d | Internal error on invalid print (py2) statement
Hi, I'd like to report a bug that occurred during using flake8. Please don't ask me about the code, I'm just analyzing data submitted by other people. Thanks!
## Packages
```
$ pip freeze
flake8==6.0.0
flake8-json==21.7.0
mccabe==0.7.0
pycodestyle==2.10.0
pyflak... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index b87bc88..15b4c2b 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1068,7 +1068,7 @@ class Checker:
)
return handler
- def handleNodeLoad(self, node):
+ def handleNodeLoad(self, node, parent):
name = getNodeName... |
PyCQA__pyflakes-754 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:Checker._run_deferred"
],
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.__init__",
"pyflakes/checker.py:Checker.deferFunction",
"pyflakes/checker.py:Checker.runDeferred",
... | PyCQA/pyflakes | 4158a4537773ec3da41aed5afdea46c121082804 | Error when referencing a class yet not declared inside function
I am facing a bug.
I created this example to test all behaviours I can foresee and spotted a bug:
```python
from typing import Optional
class InnerModel1:
model2: "Model2"
mode2_no_err1: Optional["Model2"] # NO ERROR
mo... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 919e1bb..7ee6a1d 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -7,6 +7,7 @@ Also, it models the Bindings and Scopes.
import __future__
import builtins
import ast
+import collections
import contextlib
import doctest
import functools
@@ -7... |
PyCQA__pyflakes-761 | [
{
"changes": {
"added_entities": [
"pyflakes/checker.py:Definition.redefines"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"pyflakes/checker.py:Definition"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | 33bbb8266420e34a93ea74299177c19fd463acc0 | should produce error for attribute hidden by a method
# How to reproduce
```
$ flake8 --version
6.0.0 (mccabe: 0.7.0, pycodestyle: 2.10.0, pyflakes: 3.0.1) CPython 3.11.1 on Linux
$ flake8 ok.py
ok.py:5:5: F811 redefinition of unused 'bar' from line 2
$ flake8 fail.py
```
## `ok.py`
```python
class Foo:... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index e927715..4d778a8 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -263,6 +263,11 @@ class Definition(Binding):
"""
A binding that defines a function or a class.
"""
+ def redefines(self, other):
+ return (
+ su... |
PyCQA__pyflakes-765 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.handleNodeLoad"
],
"edited_modules": [
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker.py"
}
] | PyCQA/pyflakes | e9324649874a7124a08c3826d4cf78a4dc3aa32c | Regression with version 3.0 ('bool' object is not subscriptable)
Hello! I found a regression with version 3.0
This snippet:
```
test: int
test.__dict__
def fn():
test = 1
```
Raises the following exception with version 3.0.1:
```
Traceback (most recent call last):
File "/opt/homebrew/bin/pyfl... | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 4d778a8..e654afa 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1068,7 +1068,7 @@ class Checker:
binding = scope.get(name, None)
if isinstance(binding, Annotation) and not self._in_postponed_annotation:
- ... |
PyCQA__pyflakes-801 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyflakes/checker.py:Checker.addBinding"
],
"edited_modules": [
"pyflakes/checker.py:FunctionScope",
"pyflakes/checker.py:Checker"
]
},
"file": "pyflakes/checker... | PyCQA/pyflakes | 881ed2f00255cb247577adad59d4f05122a5f87a | False Positive: walrus in a list comprehension
Minimal reproduction:
```python
def foo(x):
fns = [lambda x: x + 1, lambda x: x + 2, lambda x: x + 3]
return [(x := fn(x)) for fn in fns]
```
This raises F841 incorrectly asserting that the `x` variable assigned in the comprehension is never used | diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 754ab30..47a59ba 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -548,7 +548,7 @@ class FunctionScope(Scope):
"""
usesLocals = False
alwaysUsed = {'__tracebackhide__', '__traceback_info__',
- '__traceback_suppleme... |
PyCQA__redbaron-125 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"redbaron/base_nodes.py:Node._get_list_attribute_is_member_off",
"redbaron/base_nodes.py:Node._get_helpers"
],
"edited_modules": [
"redbaron/base_nodes.py:Node"
]
},... | PyCQA/redbaron | ded6209dfe043f2e8c49b4ccedfbfdc1cd2d29ba | Append call argument breaks help()
Test:
``` python
code = 'a(b)'
red = RedBaron(code)[0]
red.call.append('c')
red.help(True)
```
Result:
``` Python
/anaconda3/lib/python3.5/site-packages/redbaron/base_nodes.py in help(self, deep, with_formatting)
906 def help(self, deep=2, with_formatting=False):
907 ... | diff --git a/CHANGELOG b/CHANGELOG
index fa11d48..c6e98b7 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,11 @@
Changelog
=========
+0.6.3 (unreleased)
+-----------------
+
+- fix help() after append
+
0.6.2 (2016-10-03)
----------------
diff --git a/redbaron/base_nodes.py b/redbaron/base_nodes.py
index 6222a... |
PyDMD__PyDMD-560 | [
{
"changes": {
"added_entities": [
"pydmd/bopdmd.py:BOPDMD.fit_econ"
],
"added_modules": null,
"edited_entities": [
"pydmd/bopdmd.py:BOPDMD._initialize_alpha"
],
"edited_modules": [
"pydmd/bopdmd.py:BOPDMD"
]
},
"file": "pydmd/bopdmd.py"
... | PyDMD/PyDMD | 1f6db1f15a6d07b435c6e6d25387c21f8c891074 | numpy 2.0 compatibility
Currently, PyDMD is explicitly specified as incompatible with numpy 2.0 https://github.com/PyDMD/PyDMD/blob/1f6db1f15a6d07b435c6e6d25387c21f8c891074/pyproject.toml#L7
It would be nice if that limitation was lifted.
Ref: https://numpy.org/doc/stable/numpy_2_0_migration_guide.html | diff --git a/pydmd/bopdmd.py b/pydmd/bopdmd.py
index c5aa6ac..b0f7fbd 100644
--- a/pydmd/bopdmd.py
+++ b/pydmd/bopdmd.py
@@ -1351,17 +1351,31 @@ class BOPDMD(DMDBase):
msg = "Invalid eigenvalue constraint combination provided."
raise ValueError(msg)
- def _initialize_alpha... |
PyDMD__PyDMD-568 | [
{
"changes": {
"added_entities": [
"pydmd/bopdmd.py:BOPDMD.fit_econ"
],
"added_modules": null,
"edited_entities": [
"pydmd/bopdmd.py:BOPDMD._initialize_alpha"
],
"edited_modules": [
"pydmd/bopdmd.py:BOPDMD"
]
},
"file": "pydmd/bopdmd.py"
... | PyDMD/PyDMD | 1f6db1f15a6d07b435c6e6d25387c21f8c891074 | Passing the low-rank approximation of the snapshot matrix to `BOPDMD.fit()` as an input
I am part of a team who is looking into applying optimized DMD to subsets of the [ERA5 dataset](https://cds.climate.copernicus.eu/datasets/reanalysis-era5-single-levels?tab=overview), which contains tens of TB of weather data from t... | diff --git a/pydmd/bopdmd.py b/pydmd/bopdmd.py
index c5aa6ac..b0f7fbd 100644
--- a/pydmd/bopdmd.py
+++ b/pydmd/bopdmd.py
@@ -1351,17 +1351,31 @@ class BOPDMD(DMDBase):
msg = "Invalid eigenvalue constraint combination provided."
raise ValueError(msg)
- def _initialize_alpha... |
PyFilesystem__pyfilesystem2-232 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "fs/opener/__init__.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"fs/opener/appf... | PyFilesystem/pyfilesystem2 | 335e40b0594df0ecb87107250a39be6d7e5f7d7b | Evaluated options for opener discovery
I'm not sure this is indeed an `fs` issue, but perhaps it's at least good to have it documented here, too.
We're running into a problem with embedding `fs` into an application for MacOS with py2app, where the opener registry can't find anything, because the `entry_points.txt` f... | diff --git a/fs/opener/__init__.py b/fs/opener/__init__.py
index 8f2a264..91870e7 100644
--- a/fs/opener/__init__.py
+++ b/fs/opener/__init__.py
@@ -10,6 +10,9 @@ from .base import Opener
from .parse import parse_fs_url as parse
from .registry import registry
+# Import opener modules so that `registry.install` if c... |
PyFilesystem__pyfilesystem2-313 | [
{
"changes": {
"added_entities": [
"fs/memoryfs.py:MemoryFS.close"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"fs/memoryfs.py:MemoryFS"
]
},
"file": "fs/memoryfs.py"
}
] | PyFilesystem/pyfilesystem2 | 37b46b4a991a124f4d8e199e111ee21f00c2213b | Free memory on MemoryFS.close
Steps to reproduce:
1. Run this piece of code in your favorite REPL.
```python
from fs.memoryfs import MemoryFS
mem_fs = MemoryFS()
with open('large_binary_file', 'rb') as f:
mem_fs.upload('/large_binary_file', f)
mem_fs.close()
```
2. Watch python process before and after ru... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index aaf125a..b36f9a9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](htt... |
PyFilesystem__pyfilesystem2-314 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"fs/base.py:FS.opendir"
],
"edited_modules": [
"fs/base.py:FS"
]
},
"file": "fs/base.py"
},
{
"changes": {
"added_entities": [
"fs/memoryfs.py:Memo... | PyFilesystem/pyfilesystem2 | 37b46b4a991a124f4d8e199e111ee21f00c2213b | Expose SubFS factory
There are some custom methods (i.e. not overrides) on GoogleFS and OneDriveFS to expose specific features of those filesystems.
My problem is that makedir(s) returns a SubFS which then doesn't support those custom methods so you can't use it transparently (e.g. in the tests)
I see that opendir ... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index aaf125a..b36f9a9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](htt... |
PyFilesystem__pyfilesystem2-315 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"fs/ftpfs.py:ftp_errors"
],
"edited_modules": [
"fs/ftpfs.py:ftp_errors"
]
},
"file": "fs/ftpfs.py"
}
] | PyFilesystem/pyfilesystem2 | c23cfca6f98335aa82db62fc51d36f435b8dfd2c | FTPFS: EOFError in listdir
Hello,
I am new to pyfilesystem, so please excuse if i might have missed something. From what i can understand from the documentation pyfilesystem2 translates exceptions from the underlying filesystem into a common set of exceptions.
There seems to be a corner case for ftpfs where it mi... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index b36f9a9..d92e0ec 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `MemFS` now immediately releases all memory it holds when `close()` is called,
rather than when it gets garbage co... |
PyFilesystem__pyfilesystem2-396 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "fs/_ftp_parse.py"
}
] | PyFilesystem/pyfilesystem2 | 34084cf5d1027d413fff265c93af5b8dc0685ea7 | fs/_ftp_parse.py fails when parsing directory listing on NT format if folder or filename contains AM or PM
The regex pattern used to parse the directory listing for NT servers uses a greedy (default) pattern when parsing the modified date column. This causes the `(<modified>)` capture group to capture until the last AM... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0449d14..7cec240 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
ensuring `conftest.py` is present, fixes [#364](https://github.com/PyFilesystem/pyfilesystem2/issues/364).
- Stop patc... |
PyFilesystem__pyfilesystem2-439 | [
{
"changes": {
"added_entities": [
"fs/_ftp_parse.py:_decode_linux_time",
"fs/_ftp_parse.py:_decode_windowsnt_time"
],
"added_modules": [
"fs/_ftp_parse.py:_decode_linux_time",
"fs/_ftp_parse.py:_decode_windowsnt_time"
],
"edited_entities": [
... | PyFilesystem/pyfilesystem2 | c5d193bf7e4b3696386d6d4439e8192d5060f6d6 | Add support for different FTP LIST locales (Windows CE exclusive?)
We are using pyfilesystem2 to access a German locale FTP server on an MS Windows CE operating system. I cannot pinpoint whether it is the locale, the OS, or a different factor altogether, but the FTP LIST command, which is apparently used almost everywh... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3b965c9..9e0a768 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Missing `mode` attribute to `_MemoryFile` objects returned by `MemoryFS.openbin`.
- Missing `readinto` method for `Mem... |
PyFilesystem__pyfilesystem2-457 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"fs/ftpfs.py:FTPFS.upload"
],
"edited_modules": [
"fs/ftpfs.py:FTPFS"
]
},
"file": "fs/ftpfs.py"
}
] | PyFilesystem/pyfilesystem2 | 64d7a52e1f3037f33937f91e9db812cafdbbafc0 | fs.ftpfs.FTPFS.upload opens new connections
Hi,
I'm looking at this function:
https://github.com/PyFilesystem/pyfilesystem2/blob/64d7a52e1f3037f33937f91e9db812cafdbbafc0/fs/ftpfs.py#L813
`_manage_ftp` always opens a new FTP connection, together with user login, "FEAT" command and so on. This is done everytime one ... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 31cb320..4dfe905 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Make `FTPFile`, `MemoryFile` and `RawWrapper` accept [`array.array`](https://docs.python.org/3/library/array.html)
a... |
PyFilesystem__pyfilesystem2-462 | [
{
"changes": {
"added_entities": [
"fs/base.py:FS.getmodified"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"fs/base.py:FS"
]
},
"file": "fs/base.py"
},
{
"changes": {
"added_entities": null,
"added_modules... | PyFilesystem/pyfilesystem2 | ac8a91add9259c5be2caf1746be1db146ea78390 | FTPFS should use MDTM
Regarding fs.ftpfs.FS.getinfo (https://github.com/PyFilesystem/pyfilesystem2/blob/64d7a52e1f3037f33937f91e9db812cafdbbafc0/fs/ftpfs.py#L648)
That function tries to use MLST to retrieve arbitrary information of a single file and defaults to LIST if MLST is not supported.
This makes `fs.copy_di... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index c24b0e6..968dc67 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Added `fs.copy.copy_file_if`, `fs.copy.copy_dir_if`, and `fs.copy.copy_fs_if`.
Closes [#458](https://github.com/... |
PyFilesystem__pyfilesystem2-463 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"fs/_bulk.py:Copier.__init__",
"fs/_bulk.py:Copier.stop",
"fs/_bulk.py:Copier.copy"
],
"edited_modules": [
"fs/_bulk.py:Copier"
]
},
"file": "fs/_bulk.py... | PyFilesystem/pyfilesystem2 | 5f737783cd79bb462b838a26b582cb05832339e4 | original timestamp (ctime, mtime) cannot survive a copy_fs or mirror
as long as there's actual "copy" operation from one fs to another, then those "touched" files will lost their original ctime or mtime, which would be updated to the time when that copy operation happened.
this is not expected feature. though calling ... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3f933fb..c24b0e6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Better documentation of the `writable` parameter of `fs.open_fs`, and
hint about using `fs.wrap.read_only` when a re... |
PyFilesystem__pyfilesystem2-464 | [
{
"changes": {
"added_entities": [
"fs/base.py:FS.match_glob"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"fs/base.py:FS"
]
},
"file": "fs/base.py"
},
{
"changes": {
"added_entities": [
"fs/errors.py:Pat... | PyFilesystem/pyfilesystem2 | 50b1c9956ee0c674c93ffbf675a7b0f58db2564d | filter_dirs in walk.dirs behaves unintuitive and its description is a bit misleading
Talking about https://docs.pyfilesystem.org/en/latest/reference/walk.html#fs.walk.BoundWalker.dirs and maybe `walk.files` is affected as well.
The documentation talks about (emphasis by me):
> **dirs(path='/', \*\*kwargs)**
> Wa... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 267c942..837f494 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
## Unreleased
+### Added
+
+- Added `filter_glob` and `exclude_glob` parameters to `fs.walk.Walker`.
+ Closes [#459](... |
PyFilesystem__pyfilesystem2-470 | [
{
"changes": {
"added_entities": [
"fs/wrap.py:WrapReadOnly.removetree"
],
"added_modules": null,
"edited_entities": [
"fs/wrap.py:WrapCachedDir.isdir",
"fs/wrap.py:WrapCachedDir.isfile"
],
"edited_modules": [
"fs/wrap.py:WrapCachedDir",
... | PyFilesystem/pyfilesystem2 | 94f032399c84da4a9fff968bf5d666ec35d502c8 | WrapReadOnly does not wrap `removetree`
`fs.wrap.WrapReadOnly` does not wrap `FS.removetree`, so it's still possible to remove a folder with this method. | diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4dfe905..0b80ff8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
arguments for the `write` and `writelines` methods, as expected by their base class [`io.RawIOBase`](https://docs.pytho... |
PyFilesystem__pyfilesystem2-473 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"fs/_ftp_parse.py:decode_linux"
],
"edited_modules": [
"fs/_ftp_parse.py:decode_linux"
]
},
"file": "fs/_ftp_parse.py"
}
] | PyFilesystem/pyfilesystem2 | 4efe083ebb1a43aafd0e171b3b20d6b546c86756 | FTPFS does not list certain folders
It seems that the pub folder is not listed and igrnoed. ftplib does show the folder. This is with python 3.8.
```python
import fs
fs.__version__
# 2.4.12
from fs.ftpfs import FTPFS
a = FTP(host='ftp.ensemblgenomes.org', user="anonymous", passwd="")
a.dir()
""""
drwxr... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index c99ffcc..aacded9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -25,7 +25,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
test suites.
- `FSTestCases` now builds the large data required for `upload` and `download` tests only
once in orde... |
PyFilesystem__pyfilesystem2-474 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"fs/errors.py:PathError.__init__",
"fs/errors.py:PathError.__reduce__"
],
"edited_modules": [
"fs/errors.py:PathError"
]
},
"file": "fs/errors.py"
}
] | PyFilesystem/pyfilesystem2 | 60b0a6347e3bbcee4a2a6261a5e1b3166c45e192 | convert_os_errors error when converting errno.ENAMETOOLONG to PathError
Using convert_os_errors to convert errno.ENAMETOOLONG to PathError results in unexpected keyword arguement 'exc' error. Seems that [this line](https://github.com/PyFilesystem/pyfilesystem2/blob/8784fd61797fac654511f16fd50c38c8a1675f16/fs/error_tool... | diff --git a/CHANGELOG.md b/CHANGELOG.md
index aacded9..62cc085 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Added FTP over TLS (FTPS) support to FTPFS.
Closes [#437](https://github.com/PyFilesystem/pyfilesystem2/issues/437),... |
PyFstat__PyFstat-447 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyfstat/helper_functions.py:run_commandline"
],
"edited_modules": [
"pyfstat/helper_functions.py:run_commandline"
]
},
"file": "pyfstat/helper_functions.py"
}
] | PyFstat/PyFstat | 99d4daf587059456bc1f1134cc06a72aad8781fd | better catch lalpulsar executable output
As a followup to #435, lalpulsar (formerly lalapps) executable output still goes straight to stdout, not through logging. Probably needs a fix to `run_commandline`. | diff --git a/pyfstat/helper_functions.py b/pyfstat/helper_functions.py
index d07ade4..2e69aeb 100644
--- a/pyfstat/helper_functions.py
+++ b/pyfstat/helper_functions.py
@@ -13,6 +13,7 @@ import shutil
import subprocess
from datetime import datetime, timezone
from functools import wraps
+from typing import Union
i... |
PyFstat__PyFstat-529 | [
{
"changes": {
"added_entities": [
"pyfstat/tcw_fstat_map_funcs.py:_get_transient_fstat_map_features"
],
"added_modules": [
"pyfstat/tcw_fstat_map_funcs.py:_get_transient_fstat_map_features"
],
"edited_entities": [
"pyfstat/tcw_fstat_map_funcs.py:init_transi... | PyFstat/PyFstat | 306ac72599a7c3b4680b07e27e42754568f2038b | pycuda F-stat maps: add condition number checks?
LALSuite has had a check on the condition number of the antenna pattern matrix since 2018 ([code link](https://lscsoft.docs.ligo.org/lalsuite/lalpulsar/group___l_a_l_compute_a_m__h.html#gad7ba2b601622946ba930216477c832b4); bonus historical reference, though probably not ... | diff --git a/pyfstat/pyCUDAkernels/cudaTransientFstatExpWindow.cu b/pyfstat/pyCUDAkernels/cudaTransientFstatExpWindow.cu
index 85d9972..092771d 100644
--- a/pyfstat/pyCUDAkernels/cudaTransientFstatExpWindow.cu
+++ b/pyfstat/pyCUDAkernels/cudaTransientFstatExpWindow.cu
@@ -101,21 +101,32 @@ __global__ void cudaTransient... |
PyMySQL__PyMySQL-1127 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pymysql/charset.py:Charset.__init__",
"pymysql/charset.py:Charset.__repr__",
"pymysql/charset.py:Charsets.by_name"
],
"edited_modules": [
"pymysql/charset.py:Charset"... | PyMySQL/PyMySQL | f4c348fdcf4ac21a92be58b6f94e9d7a13826a38 | Impossible to use utf8mb3
**Describe the bug**
I have old db that should be migrated to new mariadb server, after data migration I failed to connect to it because of collate that db was created.
```
Traceback (most recent call last):
File "/root/test.py", line 23, in <module>
mysqlconnect()
File "/root/... | diff --git a/pymysql/charset.py b/pymysql/charset.py
index cdc0216..b1c1ca8 100644
--- a/pymysql/charset.py
+++ b/pymysql/charset.py
@@ -1,16 +1,16 @@
+# Internal use only. Do not use directly.
+
MBLENGTH = {8: 1, 33: 3, 88: 2, 91: 2}
class Charset:
- def __init__(self, id, name, collation, is_default):
+ d... |
PyMySQL__PyMySQL-1160 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pymysql/connections.py:Connection._read_packet"
],
"edited_modules": [
"pymysql/connections.py:Connection"
]
},
"file": "pymysql/connections.py"
},
{
"changes":... | PyMySQL/PyMySQL | 9694747ae619e88b792a8e0b4c08036572452584 | Display log exception when MySQL throws Too many connections exception.
**Describe the bug**
Display log exception when MySQL throws `Too many connections exception`.
The log: `pymysql.err.OperationalError: (1040, 'ny connections')`
**To Reproduce**
MySQL Server
--
Product: | MySQL Community Server (GPL)
... | diff --git a/pymysql/connections.py b/pymysql/connections.py
index dc121e1..3a04ddd 100644
--- a/pymysql/connections.py
+++ b/pymysql/connections.py
@@ -765,8 +765,6 @@ class Connection:
dump_packet(recv_data)
buff += recv_data
# https://dev.mysql.com/doc/internals/en/sending-... |
PyPSA__PyPSA-1091 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pypsa/descriptors.py:get_switchable_as_dense",
"pypsa/descriptors.py:get_activity_mask",
"pypsa/descriptors.py:update_linkports_component_attrs"
],
"edited_modules": [
... | PyPSA/PyPSA | c36338c171cef52cdce7cd445795ee362435f6ea | set_snapshots reindexing to multiindex resets all data
### Version Checks (indicate both or one)
- [X] I have confirmed this bug exists on the lastest [release](https://github.com/pypsa/pypsa/releases) of PyPSA.
- [X] I have confirmed this bug exists on the current [`master`](https://github.com/pypsa/pypsa/tree/m... | diff --git a/doc/references/release-notes.rst b/doc/references/release-notes.rst
index 867ec714..dfb19486 100644
--- a/doc/references/release-notes.rst
+++ b/doc/references/release-notes.rst
@@ -11,6 +11,13 @@ Upcoming Release
To use the features already you have to install the ``master`` branch, e.g.
``pip inst... |
PyPSA__PyPSA-1112 | [
{
"changes": {
"added_entities": [
"pypsa/consistency.py:_log_or_raise"
],
"added_modules": [
"pypsa/consistency.py:ConsistencyError",
"pypsa/consistency.py:_log_or_raise"
],
"edited_entities": [
"pypsa/consistency.py:check_for_unknown_buses",
... | PyPSA/PyPSA | 5822ff21dc327ab4404c9557f6f61e4da56fabf8 | Make consistency check optionally strict
For some pypsa functions we need input that is already checked in the consistency checks. Therefore it would be good to have the consistency checks optionally in strict mode to raise an error instead of a warning.
For example, for generalized plotting functions we need color... | diff --git a/doc/references/release-notes.rst b/doc/references/release-notes.rst
index dfb19486..d1546551 100644
--- a/doc/references/release-notes.rst
+++ b/doc/references/release-notes.rst
@@ -40,6 +40,10 @@ Features
via the `issue tracker <https://github.com/PyPSA/PyPSA/issues/new>`__ on
GitHub.
+* Cons... |
PyPSA__PyPSA-443 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pypsa/components.py:Network.__init__"
],
"edited_modules": [
"pypsa/components.py:Network"
]
},
"file": "pypsa/components.py"
},
{
"changes": {
"added_ent... | PyPSA/PyPSA | 764e4978e793813e32b5db2aa47655a3caa2b291 | Cannot use pathlib.Path for opening with pypsa.Network(...)
Paths of networks need to be provided as `str` and `pathlib.Path` is not supported when trying to open Networks using `pypsa.Netowrk(...)`. See screenshot:
 defaults
Avoid confusion in df aggregation methods. Instead of defining a single default time aggregation method in class `StatisticsAccessor`, use defaults from each metric function. | diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index c5177de2..3a525cb3 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -22,6 +22,7 @@ Upcoming Release
to change the default snapshot weightings, and ``weightings_from_timedelta``
to compute the weights if snapshots are of type ``pd.Da... |
PyPSA__PyPSA-666 | [
{
"changes": {
"added_entities": [
"pypsa/linopf.py:define_modular_variables",
"pypsa/linopf.py:define_modular_constraints"
],
"added_modules": [
"pypsa/linopf.py:define_modular_variables",
"pypsa/linopf.py:define_modular_constraints"
],
"edited_enti... | PyPSA/PyPSA | 18f9682f339a3ad127ef2f7c6840cc105013bb24 | Modular investment capacity
<!-- Please do not post usage questions here. Ask them on the PyPSA mailing list: https://groups.google.com/forum/#!forum/pypsa -->
## Describe the feature you'd like to see
It would be interesting to add the modularity in the investment capacity: rather than having a pure LP formulati... | diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index 637ef29c..b90416ff 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -69,6 +69,12 @@ PyPSA 0.25.1 (27th July 2023)
those that already have a designated place in the network are assigned.
(https://github.com/PyPSA/PyPSA/pull/635)
+*... |
PyPSA__PyPSA-669 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "examples/sector-coupling/biomass-synthetic-fuels-carbon-management.py"
},
{
"changes": {
"added_entities": null,
"added_modules": null,
... | PyPSA/PyPSA | c0fb2eca83187781015c5988d6c606de268533a6 | By default, have multilinks in pypsa networks
options:
- create columns and semantics on the fly
- n = pypsa.Network(multilinks=3) | diff --git a/doc/components.rst b/doc/components.rst
index 9fbbe20e..7ba4abeb 100644
--- a/doc/components.rst
+++ b/doc/components.rst
@@ -438,18 +438,10 @@ these are used in the LOPF and the `example of a CHP with a fixed
power-heat ratio
<https://pypsa.readthedocs.io/en/latest/examples/chp-fixed-heat-power-ratio.ht... |
PyPSA__PyPSA-784 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pypsa/io.py:import_from_netcdf"
],
"edited_modules": [
"pypsa/io.py:import_from_netcdf"
]
},
"file": "pypsa/io.py"
}
] | PyPSA/PyPSA | 9df3c7e951438375e0a4e7f4f52fd95cc3daaa7c | import_from_netcdf fails when importing from an XArray instance
## Checklist
- [X] I am using the current [`master`](https://github.com/pypsa/pypsa/tree/master) branch or the latest [release](https://github.com/pypsa/pypsa/releases).
## Describe the Bug
The [docs](https://pypsa.readthedocs.io/en/latest/api_ref... | diff --git a/pypsa/io.py b/pypsa/io.py
index 1fbb37d5..42fe4a65 100644
--- a/pypsa/io.py
+++ b/pypsa/io.py
@@ -653,7 +653,7 @@ def import_from_netcdf(network, path, skip_time=False):
"""
assert has_xarray, "xarray must be installed for netCDF support."
- basename = Path(path).name
+ basename = "" if i... |
PyPSA__PyPSA-891 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pypsa/clustering/spatial.py:get_clustering_from_busmap"
],
"edited_modules": [
"pypsa/clustering/spatial.py:get_clustering_from_busmap"
]
},
"file": "pypsa/clustering/s... | PyPSA/PyPSA | 6477a028855a336453c96c92b1c69072ec80f777 | Investment periods dropped when clustering by busmap
<!-- Please do not post usage questions here. Ask them on the PyPSA mailing list: https://groups.google.com/forum/#!forum/pypsa -->
## Checklist
- [x] I am using the current [`master`](https://github.com/pypsa/pypsa/tree/master) branch or the latest [release](h... | diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index c5d9e040..0c8455b3 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -12,6 +12,8 @@ Release Notes
* HiGHS becomes the new default solver for ``n.optimize()``.
+* Bugfix: Retain investment periods and weightings when clustering network... |
PyPSA__PyPSA-924 | [
{
"changes": {
"added_entities": [
"pypsa/components.py:Network.__eq__"
],
"added_modules": null,
"edited_entities": [
"pypsa/components.py:Network.set_snapshots",
"pypsa/components.py:Network.set_investment_periods",
"pypsa/components.py:Network.copy"
... | PyPSA/PyPSA | 94fdc994beacc482c720892e0e5e2a77968efcc4 | Performance: Faster network.copy(), perhaps using copy.deepcopy
At present, copying a network with `pypsa.Network().copy()` takes a surprisingly long time. For some workflows this actually seems to be a performance bottleneck.
I noticed that using the builtin `copy.deepcopy` seems to do the same job much faster:
... | diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index 2196ccf1..f5074df3 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -12,15 +12,21 @@ Upcoming Release
* HiGHS becomes the new default solver for ``n.optimize()``.
+* Add functionality to compare two networks for equality via equality... |
PyPSA__atlite-222 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"atlite/convert.py:convert_line_rating"
],
"edited_modules": [
"atlite/convert.py:convert_line_rating"
]
},
"file": "atlite/convert.py"
},
{
"changes": {
"... | PyPSA/atlite | 6c69d5185886b469342887526de641a6c9e9aab3 | Remove atmospheric_insolation from SolarPosition function
This variable is neither needed with the current modules nor at the right place. If needed its calculation should be part of the preparation process | diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst
index 9631000..487132a 100644
--- a/RELEASE_NOTES.rst
+++ b/RELEASE_NOTES.rst
@@ -22,6 +22,7 @@ Release Notes
* Due to ambiguity, conversion functions (`.pv(...)`, `.wind(...)` etc.) now raise an `ValueError` if shapes and matrix are given.
* Atlite now supports cal... |
PyPSA__atlite-226 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"atlite/gis.py:ExclusionContainer.all_closed",
"atlite/gis.py:ExclusionContainer.all_open"
],
"edited_modules": [
"atlite/gis.py:ExclusionContainer"
]
},
"file":... | PyPSA/atlite | f8a43d6e6aebe7ba1946ca8a085d155ebabf1e83 | Shapefile path added through `add_geometry` not read when no rasters are provided
<!---
SPDX-FileCopyrightText: 2021 The Atlite Authors
SPDX-License-Identifier: CC0-1.0
--->
<!-- Provide a general summary of the issue -->
## Description
<!-- Provide a more detailed introduction to the issue itself, and wh... | diff --git a/RELEASE_NOTES.rst b/RELEASE_NOTES.rst
index b3f92d6..05df63c 100644
--- a/RELEASE_NOTES.rst
+++ b/RELEASE_NOTES.rst
@@ -14,6 +14,9 @@ Release Notes
* Bugfix: When creating cutouts using SARAH2 data, an error was previously wrongly thrown if exactly
the data was available as input as required. The error... |
PyPSA__atlite-316 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"atlite/convert.py:wind"
],
"edited_modules": [
"atlite/convert.py:wind"
]
},
"file": "atlite/convert.py"
},
{
"changes": {
"added_entities": [
"at... | PyPSA/atlite | 549d0fdf22925e06ac3f726e801f215d993671dc | Wind Conversion: potential bug when power curve does not end with zero after cutout speed
<!---
SPDX-FileCopyrightText: 2021 The Atlite Authors
SPDX-License-Identifier: CC0-1.0
--->
<!-- Provide a general summary of the issue -->
## Description
<!-- Provide a more detailed introduction to the issue itself... | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index fa07480..b333723 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -45,7 +45,7 @@ repos:
# Formatting with "black" coding style
- repo: https://github.com/psf/black
- rev: 23.7.0
+ rev: 23.9.1
hooks:
# Format Python fil... |
PyPSA__linopy-104 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"linopy/expressions.py:LinearExpression.__repr__"
],
"edited_modules": [
"linopy/expressions.py:LinearExpression"
]
},
"file": "linopy/expressions.py"
},
{
"chan... | PyPSA/linopy | 24a57726b2a26072760fbb4b0f9a4225cec7e69b | Fix print out of empty LinearExpression | diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index bd4b5ee..778cfd6 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -1,8 +1,10 @@
Release Notes
=============
-.. Upcoming Release
-.. ----------------
+Upcoming Release
+----------------
+
+* Fix representation of empty variables and l... |
PyPSA__linopy-113 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"linopy/expressions.py:LinearExpression"
]
},
"file": "linopy/expressions.py"
},
{
"changes": {
"added_entities": null,
"added_modules": nu... | PyPSA/linopy | 62ac3ea8f4b3cefef9ca7df55132e6161a8fb699 | Shuffled constraints and variables causing infeasibilities
Dear linopy team,
I am currently using linopy 0.1.4 with PyPSA 0.22.1
While trying to solve a small optimisation model via PyPSA, I encountered some infeasibilities on a model which shouldn't have any. The issue happens in the specific case where I combin... | diff --git a/linopy/expressions.py b/linopy/expressions.py
index ae0be11..21ebe5f 100644
--- a/linopy/expressions.py
+++ b/linopy/expressions.py
@@ -886,6 +886,8 @@ class LinearExpression:
reindex = exprwrap(Dataset.reindex, fill_value=_fill_value)
+ reindex_like = exprwrap(Dataset.reindex_like, fill_value=... |
PyPSA__linopy-136 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"linopy/common.py:fill_missing_coords",
"linopy/common.py:print_single_expression"
],
"edited_modules": [
"linopy/common.py:fill_missing_coords",
"linopy/common.py:pri... | PyPSA/linopy | 1c386b0d1469182238e6dde5b0ca161716006a8c | Support Quadratic terms
A new class QuadraticExpression could be added which follows the same scheme as LinearExpression but has the data fields
* coeffs
* vars1
* vars2
Arithmetic operations with lhs have to be checked rigorously. | diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index d1fc0e9..9c98835 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -6,6 +6,8 @@ Upcoming Release
**New Features**
+
+* Linopy now supports quadratic programming. Therefore a new class `QuadraticExpression` was created, which can be as... |
PyPSA__linopy-412 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"linopy/expressions.py:LinearExpression.__repr__",
"linopy/expressions.py:LinearExpression._multiply_by_constant",
"linopy/expressions.py:ScalarLinearExpression.__add__",
"linopy/... | PyPSA/linopy | 9b80b320a3961f3696de0b8aa249ab10026746bf | Multiplication by constant to introduce a new dimension
### Version Checks (indicate both or one)
- [x] I have confirmed this bug exists on the lastest [release](https://github.com/pypsa/linopy/releases) of Linopy.
- [x] I have confirmed this bug exists on the current [`master`](https://github.com/pypsa/linopy/tree/m... | diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index 787c633..0a42d6b 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -5,6 +5,7 @@ Upcoming Version
----------------
* The internal handling of `Solution` objects was improved for more consistency. Solution objects created from solver cal... |
PyPSA__linopy-438 | [
{
"changes": {
"added_entities": [
"linopy/constraints.py:Constraints.__getstate__",
"linopy/constraints.py:Constraints.__setstate__"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"linopy/constraints.py:Constraints"
]
},
... | PyPSA/linopy | a57d24be104dfcdbf316ee68f9b89d06ca30795f | Serializing and deserializing linopy.Model
Hi,
I am currently exploring/trying to setup larger models in parallel (in individual processes) and pass them back to the main process. Because the individual models are fairly large but can be prepared individually and largely independend from each other. Later on linked ... | diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index ff3f74f..3eeaeb4 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -13,6 +13,10 @@ Version 0.5.2
This is mainly affecting operations where single numerical items from pandas objects
are selected and used for multiplication.
+**Feature... |
PyPSA__linopy-77 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"linopy/constraints.py:Constraints.to_matrix"
],
"edited_modules": [
"linopy/constraints.py:Constraints"
]
},
"file": "linopy/constraints.py"
},
{
"changes": {
... | PyPSA/linopy | b05fb5b8c96bf6b885696de98d880c2f430e7192 | Add automatic merging of variables
At the moment linopy will create two coefficients if the same variable is used twice in the same expression. Gurobi can resolve this automatically but it prints a warning, but HiGHS seems to struggle with such equations (see example below). A solution to this would be to merge identic... | diff --git a/doc/release_notes.rst b/doc/release_notes.rst
index 9158982..21e1cbf 100644
--- a/doc/release_notes.rst
+++ b/doc/release_notes.rst
@@ -5,6 +5,7 @@ Upcoming Release
----------------
* Linopy now defines and uses a fixed set of solver status and termination codes. This allows for a more consistent and r... |
PyPSA__linopy-79 | [
{
"changes": {
"added_entities": [
"linopy/expressions.py:LinearExpression.diff"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"linopy/expressions.py:LinearExpression"
]
},
"file": "linopy/expressions.py"
},
{
"changes"... | PyPSA/linopy | 1ea0bab835f979063eea96287f12cb083c6d37e2 | Add support of xarray's `diff` function to Variable class
The class `linopy.variables.Variable` inherits methods from its parent `xarray.DataArray`. Some of these methods seem to lead to wrong optimization results.
Example:
```
m = linopy.Model()
var = m.add_variables(name="var", lower=xr.DataArray(np.zeros(5)... | diff --git a/linopy/expressions.py b/linopy/expressions.py
index 3e9e9f0..d7c8b7b 100644
--- a/linopy/expressions.py
+++ b/linopy/expressions.py
@@ -495,6 +495,26 @@ class LinearExpression:
cond = _expr_unwrap(cond)
return self.__class__(self.data.where(cond, other=other, **kwargs))
+ def diff(se... |
Pylons__colander-321 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"colander/__init__.py:Number.serialize"
],
"edited_modules": [
"colander/__init__.py:Number"
]
},
"file": "colander/__init__.py"
}
] | Pylons/colander | b7acdff5e83e41208c323f8cac52c48ff6328a85 | Why not allow `None` in an appstruct serialized by Number?
relates to part of #186
A commit was made a while ago that removed the ability to pass `None` as an appstruct value to a `Number` type ( commit 513d860 ). The commit says it's reverting a change related to **Strings** but then made this change to `Number`. I... | diff --git a/CHANGES.rst b/CHANGES.rst
index 43c932c..669d34e 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,3 +1,10 @@
+Unreleased
+==========
+
+- Number once again will allow you to serialize None to colander.null, this
+ reverts an accidental revert. See
+ https://github.com/Pylons/colander/issues/204#issuecomm... |
Pylons__colander-322 | [
{
"changes": {
"added_entities": [
"colander/__init__.py:Integer.__init__"
],
"added_modules": null,
"edited_entities": null,
"edited_modules": [
"colander/__init__.py:Integer"
]
},
"file": "colander/__init__.py"
}
] | Pylons/colander | 1c3bd63aa06b4f01081035c1b54ff4586aef4c9f | passing a float to colander.Integer does not throw exception
When passing a float value (e.g. 1.21) to a colander.Integer node, no exception is thrown.
I am not sure of the expected behaviour though...
Version: 1.3.3 | diff --git a/CHANGES.rst b/CHANGES.rst
index c40160b..babbd56 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -11,6 +11,11 @@ Unreleased
reverts an accidental revert. See
https://github.com/Pylons/colander/issues/204#issuecomment-459556100
+- Integer SchemaType now supports an optional ``strict`` mode that will
+... |
Pylons__colander-323 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "colander/__init__.py"
}
] | Pylons/colander | 1c3bd63aa06b4f01081035c1b54ff4586aef4c9f | Unclosed parenthesis in URL causes infinite loop
When there is an unclosed parenthesis in URL and we use _url_ validator, it causes an infinite loop. What's more interesting is that it only happens when the unclosed parenthesis is followed by many characters (check test case number 3 and 4).
```
from colander import ... | diff --git a/CHANGES.rst b/CHANGES.rst
index c40160b..f3f5d14 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,23 @@
Unreleased
==========
+- The URL validator regex has been updated to no longer be vulnerable to a
+ catastrophic backtracking that would have led to an infinite loop. See
+ https://github.com/... |
Pylons__colander-324 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": null,
"edited_modules": null
},
"file": "colander/__init__.py"
}
] | Pylons/colander | b7acdff5e83e41208c323f8cac52c48ff6328a85 | Email validator does not allow double hyphen
`lorem@i--ipsum.com` is a valid email address but the current email validator doesn't validate it.
Here's an email validator that I wrote with code that I stole from Django which works:
```python
class Email(object):
"""
Email validator shamelessly stolen fr... | diff --git a/CHANGES.rst b/CHANGES.rst
index 43c932c..1d64b84 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,3 +1,12 @@
+Unreleased
+==========
+
+- The Email validator has been updated to use the same regular expression that
+ is used by the WhatWG HTML specification, thereby increasing the email
+ addresses that ... |
Pylons__colander-333 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"colander/__init__.py:All.__call__"
],
"edited_modules": [
"colander/__init__.py:All"
]
},
"file": "colander/__init__.py"
}
] | Pylons/colander | 670d15394bf158cc974a9cdf4b9c7b496e2d5322 | Nested validators: colander.All and colander.Any
Hi,
it would be great if meta-validators (All, Any and so) could be nested in each other.
For example:
```
validator=colander.All(
colander.Any(
first_validator,
... | diff --git a/CHANGES.rst b/CHANGES.rst
index b004541..a547106 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,3 +1,12 @@
+Unreleased
+==================
+
+- :class:`colander.All` now supports :attr:`colander.Invalid.msg` being ``None``
+ or a list, otherwise :meth:`colander.Invalid.asdict` crashes with
+ ``TypeErro... |
Pylons__colander-348 | [
{
"changes": {
"added_entities": [
"src/colander/__init__.py:DataURL.__init__",
"src/colander/__init__.py:DataURL.__call__"
],
"added_modules": [
"src/colander/__init__.py:DataURL"
],
"edited_entities": null,
"edited_modules": null
},
"file": "... | Pylons/colander | a1c525c1f172dc43bd82ba62bcb5521f853a760c | Add data URLs to the URL validator
Colander provides a [`colander.url`](https://docs.pylonsproject.org/projects/colander/en/latest/api.html#colander.url) regex that validates only http/s and ftp/s schemes:
https://github.com/Pylons/colander/blob/048fb24eeb6c3df21831413943dbf89d7b5776e4/src/colander/__init__.py#L610-... | diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index 80d9573..9b02033 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -143,3 +143,4 @@ Contributors
- Damian Dimmich, 2020/07/19
- Keith M Franklin, 2020/07/30
- Scott Maki, 2020/11/15
+- Jens Troeger, 2022/07/03
diff --git a/docs/api.rst b/docs/api.rst
index... |
Pylons__pyramid_zodbconn-8 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"pyramid_zodbconn/__init__.py:get_connection"
],
"edited_modules": [
"pyramid_zodbconn/__init__.py:get_connection"
]
},
"file": "pyramid_zodbconn/__init__.py"
}
] | Pylons/pyramid_zodbconn | 6e2e5eb660bce5ce06f747fffe767908028d1892 | Use the transaction manager defined by the request.
https://github.com/Pylons/pyramid_zodbconn/blob/2bce04378e5d98e68cb49b3e4be47fe9e15a6ce1/pyramid_zodbconn/__init__.py#L49
This should be `primary_db.open(request.tm)` to support the request's transaction manager from pyramid_tm. Currently the pyramid scaffold is b... | diff --git a/CHANGES.txt b/CHANGES.txt
index 52d8686..2d15203 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,6 +1,12 @@
0.8 (unreleased)
----------------
+- Open primary database using ``request.tm``, if present, as the transaction
+ manager. If not present, fall back to the default / global transaction
+ mana... |
Pylons__webob-183 | [
{
"changes": {
"added_entities": null,
"added_modules": null,
"edited_entities": [
"webob/request.py:BaseRequest.decode"
],
"edited_modules": [
"webob/request.py:BaseRequest"
]
},
"file": "webob/request.py"
}
] | Pylons/webob | d396a514a22761103b7fdb05994ac7eb2eb75e36 | Request.decode tries to read from an already consumed stream
When building a request multiple times (for example different WSGI middlewares) it is not possible to call decode on the built requests apart from the first one.
Can be replicated with something like:
```python
from io import BytesIO
from webob import Reque... | diff --git a/webob/request.py b/webob/request.py
index c38cf3c..370eb7e 100644
--- a/webob/request.py
+++ b/webob/request.py
@@ -220,7 +220,7 @@ class BaseRequest(object):
)
if content_type == 'application/x-www-form-urlencoded':
- r.body = bytes_(t.transcode_query(native_(r.body)))
+ ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.