anchor stringlengths 10 14.3k | positive stringlengths 10 14.9k |
|---|---|
ExceptionGroup constructor arguments swapped causing initialization failures
#### Description
When creating ExceptionGroup instances, the constructor arguments appear to be passed in the wrong order, causing the message and exceptions sequence to be swapped during initialization.
#### Steps/Code to Reproduce
```pyt... | diff --git a/src/exceptiongroup/_exceptions.py b/src/exceptiongroup/_exceptions.py
index a4a7ace..4100748 100644
--- b/src/exceptiongroup/_exceptions.py
+++ a/src/exceptiongroup/_exceptions.py
@@ -269,7 +269,7 @@ class ExceptionGroup(BaseExceptionGroup[_ExceptionT_co], Exception):
__message: str,
__ex... |
Cache initialization in _NodeCacheItem breaks when change_time is None
Description
I'm experiencing an issue with the cache initialization in parso. When creating a new _NodeCacheItem with change_time=None, it causes errors in several scenarios.
```python
# This code fails
from parso import cache
# Create a cache i... | diff --git a/parso/cache.py b/parso/cache.py
index 5592a9f..f7bcab0 100644
--- b/parso/cache.py
+++ a/parso/cache.py
@@ -102,18 +102,13 @@ parser_cache: Dict[str, Any] = {}
class _NodeCacheItem:
def __init__(self, node, lines, change_time=None):
- """
- Initialize a new node cache item.
-
- ... |
Table direction setting inverted behavior
When setting table direction using `table.table_direction`, the behavior is inverted. Setting `WD_TABLE_DIRECTION.RTL` results in LTR behavior and vice versa. Additionally, setting the direction to `None` doesn't properly remove the bidiVisual element.
#### Steps/Code to Repr... | diff --git a/src/docx/oxml/table.py b/src/docx/oxml/table.py
index e38d585..5e0fbf5 100644
--- b/src/docx/oxml/table.py
+++ a/src/docx/oxml/table.py
@@ -167,10 +167,10 @@ class CT_Tbl(BaseOxmlElement):
@bidiVisual_val.setter
def bidiVisual_val(self, value: WD_TABLE_DIRECTION | None):
tblPr = self.tbl... |
TypeAdapter fails to resolve forward references when parent frame is None
#### Description
When creating a TypeAdapter and the parent frame cannot be fetched (returns None), the globalns and localns are incorrectly set to empty dictionaries instead of using the parent frame's globals and locals. This causes forward r... | diff --git a/pydantic/type_adapter.py b/pydantic/type_adapter.py
index a6cdaba..93eb3f4 100644
--- b/pydantic/type_adapter.py
+++ a/pydantic/type_adapter.py
@@ -216,12 +216,12 @@ class TypeAdapter(Generic[T]):
parent_frame = self._fetch_parent_frame()
if parent_frame is not None:
- global... |
# Silent authorization validation is not raising NotImplementedError
### Bug report
I noticed that the `validate_silent_authorization` method in the `RequestValidator` class is not raising a `NotImplementedError` as expected. This method should require implementation by subclasses, but it's currently returning `True`... | diff --git a/oauthlib/openid/connect/core/request_validator.py b/oauthlib/openid/connect/core/request_validator.py
index e3cea79..ead5fe5 100644
--- b/oauthlib/openid/connect/core/request_validator.py
+++ a/oauthlib/openid/connect/core/request_validator.py
@@ -205,7 +205,7 @@ class RequestValidator(OAuth2RequestValidat... |
### Issue: AttributeError in Slice Inference
#### Description
It seems there's an issue with the `infer_slice` function when handling `slice` objects. The recent changes have introduced an `AttributeError` when trying to infer attributes of a `slice`. This is causing problems when attempting to access the `start`, `s... | diff --git a/astroid/brain/brain_builtin_inference.py b/astroid/brain/brain_builtin_inference.py
index a56b152..938a8ab 100644
--- b/astroid/brain/brain_builtin_inference.py
+++ a/astroid/brain/brain_builtin_inference.py
@@ -693,46 +693,34 @@ def infer_type(node, context: InferenceContext | None = None):
def infer_s... |
AttributeError when accessing BusType attribute value in DBC files
#### Description
When working with DBC files that don't have a BusType attribute defined, the code attempts to access the `.value` property on a `None` object, causing an AttributeError.
#### Steps/Code to Reproduce
```python
import cantools
# Load... | diff --git a/src/cantools/database/can/formats/dbc.py b/src/cantools/database/can/formats/dbc.py
index a5b6092..ee3be1c 100644
--- b/src/cantools/database/can/formats/dbc.py
+++ a/src/cantools/database/can/formats/dbc.py
@@ -612,12 +612,13 @@ def _need_cycletime_def(database):
for m in database.messages... |
STR_POSITION with position parameter produces incorrect SQL for some dialects
When using `STR_POSITION` with a position parameter, the generated SQL for certain dialects produces incorrect results due to a bug in the offset calculation.
#### Steps/Code to Reproduce
```python
import sqlglot
# Test STR_POSITION with ... | diff --git a/sqlglot/dialects/dialect.py b/sqlglot/dialects/dialect.py
index 019833f..862471e 100644
--- b/sqlglot/dialects/dialect.py
+++ a/sqlglot/dialects/dialect.py
@@ -1157,12 +1157,13 @@ def strposition_sql(
func = exp.Anonymous(this=func_name, expressions=args)
if transpile_position:
- fun... |
Rolling window with timedelta fails on non-nanosecond datetime indexes
#### Description
When using rolling windows with timedelta strings (like '1s', '2D') on datetime indexes that have non-nanosecond units (microseconds, seconds, etc.), the operation fails with a NameError.
#### Steps/Code to Reproduce
```python
i... | diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py
index 69fce8c..8b10103 100644
--- b/pandas/core/window/rolling.py
+++ a/pandas/core/window/rolling.py
@@ -1926,6 +1926,15 @@ class Rolling(RollingAndExpandingMixin):
or (isinstance(self._on.dtype, ArrowDtype) and self._on.dtype.kind... |
NameError in get_user function after authentication refactoring
#### Description
The `get_user` function in `channels/auth.py` is throwing `NameError` exceptions for undefined variables `user_id`, `backend`, and `session_hash`. These variables are being referenced but not defined in the current scope.
#### Steps/Cod... | diff --git a/channels/auth.py b/channels/auth.py
index 9da53b0..25065eb 100644
--- b/channels/auth.py
+++ a/channels/auth.py
@@ -35,21 +35,26 @@ def get_user(scope):
session = scope["session"]
user = None
try:
+ user_id = _get_user_session_key(session)
backend_path = session[BACKEND_SESSI... |
QR code generation fails with TypeError when creating images
#### Description
When trying to generate QR codes, the library throws a `TypeError: unsupported operand type(s)` error during image creation. This affects all image formats including PIL, SVG, and PNG output.
#### Steps/Code to Reproduce
```python
import ... | diff --git a/qrcode/main.py b/qrcode/main.py
index 46116b5..a7bd959 100644
--- b/qrcode/main.py
+++ a/qrcode/main.py
@@ -191,7 +191,23 @@ class QRCode(Generic[GenericImage]):
self.map_data(self.data_cache, mask_pattern)
def setup_position_probe_pattern(self, row, col):
- pass
+ for r in ra... |
DateTimeParser fails to parse certain ISO 8601-like formats
**Description**
The `DateTimeParser` is currently unable to correctly parse some ISO 8601-like datetime strings. This issue seems to occur with specific formats, particularly those involving time components and time zones.
**Steps/Code to Reproduce**
```pyth... | diff --git a/arrow/parser.py b/arrow/parser.py
index 3929788..337bcd5 100644
--- b/arrow/parser.py
+++ a/arrow/parser.py
@@ -246,8 +246,9 @@ class DateTimeParser:
# TODO: since we support more than ISO 8601, we should rename this function
# IDEA: break into multiple functions
- def parse_iso(self, dateti... |
GROUP BY WITH TOTALS clause not working
I'm trying to use the WITH TOTALS option in a GROUP BY clause but it seems to be broken.
```python
from pypika import Query, Table, functions as fn
table = Table('my_table')
query = Query.from_(table).select(
table.category,
fn.Sum(table.amount)
).groupby(
table.ca... | diff --git a/pypika/queries.py b/pypika/queries.py
index 42c7c45..3ffbeb0 100644
--- b/pypika/queries.py
+++ a/pypika/queries.py
@@ -1475,8 +1475,13 @@ class QueryBuilder(Selectable, Term):
def _where_sql(self, quote_char: Optional[str] = None, **kwargs: Any) -> str:
return " WHERE {where}".format(where=s... |
LuauLexer throws NameError when processing tokens
#### Description
The LuauLexer is throwing a `NameError: name 'split_value' is not defined` when attempting to tokenize Luau code. This appears to affect the lexer's ability to process any input.
#### Steps/Code to Reproduce
```python
from pygments.lexers import Lua... | diff --git a/pygments/lexers/scripting.py b/pygments/lexers/scripting.py
index d38387e..8906666 100644
--- b/pygments/lexers/scripting.py
+++ a/pygments/lexers/scripting.py
@@ -448,7 +448,11 @@ class LuauLexer(RegexLexer):
for index, token, value in \
RegexLexer.get_tokens_unprocessed(self, te... |
Message signal tree creation returns empty list due to variable initialization order
#### Description
When loading DBC files, the `_create_signal_tree` method in the Message class returns an empty list instead of the expected signal nodes. This affects any functionality that relies on signal tree structures.
#### St... | diff --git a/src/cantools/database/can/message.py b/src/cantools/database/can/message.py
index 942b2cc..fd6ab6e 100644
--- b/src/cantools/database/can/message.py
+++ a/src/cantools/database/can/message.py
@@ -201,6 +201,12 @@ class Message:
}
def _create_signal_tree(self, codec):
+ """Create a mu... |
setComponentByName fails when componentType is empty
#### Description
When calling `setComponentByName` on ASN.1 sequence/set objects that have no defined component types, the method fails with an AttributeError. This affects both Sequence and Set types when they don't have a predefined schema.
#### Steps/Code to Re... | diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py
index 9aff5e6..192a5da 100644
--- b/pyasn1/type/univ.py
+++ a/pyasn1/type/univ.py
@@ -2380,9 +2380,9 @@ class SequenceAndSetBase(base.ConstructedAsn1Type):
return self.getComponentByPosition(idx, default=default, instantiate=instantiate)
def setComp... |
ConstraintsExclusion constraint validation broken with swapped arguments
#### Description
The `ConstraintsExclusion` constraint is not working correctly - it appears to be passing arguments in the wrong order when calling the underlying constraints, causing validation to fail unexpectedly.
#### Steps/Code to Reprodu... | diff --git a/pyasn1/type/constraint.py b/pyasn1/type/constraint.py
index 02368d0..685f237 100644
--- b/pyasn1/type/constraint.py
+++ a/pyasn1/type/constraint.py
@@ -610,12 +610,12 @@ class ConstraintsExclusion(AbstractConstraint):
def _testValue(self, value, idx):
for constraint in self._values:
... |
NamedTuple field order reversed and enum inference broken
#### Description
When using `typing.NamedTuple`, the field order gets reversed and several enum-related inference issues occur. The namedtuple fields appear in the wrong order, and enum members lose their proper `name` and `value` properties.
#### Steps/Code ... | diff --git a/astroid/brain/brain_namedtuple_enum.py b/astroid/brain/brain_namedtuple_enum.py
index 67d706d..1304b2a 100644
--- b/astroid/brain/brain_namedtuple_enum.py
+++ a/astroid/brain/brain_namedtuple_enum.py
@@ -193,8 +193,9 @@ def infer_named_tuple(
node: nodes.Call, context: InferenceContext | None = None
... |
subtract operation adds instead of subtracting
When using the `subtract` operation to update a document field, it actually adds the value instead of subtracting it.
#### Steps/Code to Reproduce
```python
from tinydb import TinyDB
from tinydb.operations import subtract
from tinydb.queries import where
# Create a dat... | diff --git a/tinydb/operations.py b/tinydb/operations.py
index 47c3492..837882e 100644
--- b/tinydb/operations.py
+++ a/tinydb/operations.py
@@ -34,7 +34,7 @@ def subtract(field, n):
Subtract ``n`` to a given field in the document.
"""
def transform(doc):
- doc[field] += n
+ doc[field] -= n... |
Channel recv() returns reversed byte order
#### Description
When reading data from a channel using `recv()`, the returned bytes are in reversed order compared to what was sent.
#### Steps/Code to Reproduce
```python
import paramiko
# Set up SSH connection and channel
ssh = paramiko.SSHClient()
ssh.set_missing_host... | diff --git a/paramiko/channel.py b/paramiko/channel.py
index 25326ca..54509ef 100644
--- b/paramiko/channel.py
+++ a/paramiko/channel.py
@@ -696,18 +696,18 @@ class Channel(ClosingContextManager):
try:
out = self.in_buffer.read(nbytes, self.timeout)
except PipeTimeout:
- return... |
Parser fails to handle version snapshots without preceding keywords
#### Description
The parser is unable to correctly parse version snapshot clauses when they appear without preceding keywords like `FROM`, `BETWEEN`, or `AS OF`. This causes parsing errors for valid SQL statements that use `TIMESTAMP` or `VERSION` sn... | diff --git a/sqlglot/parser.py b/sqlglot/parser.py
index 248a128..678fbe0 100644
--- b/sqlglot/parser.py
+++ a/sqlglot/parser.py
@@ -3953,6 +3953,12 @@ class Parser(metaclass=_Parser):
return this
def _parse_version(self) -> t.Optional[exp.Version]:
+ if self._match(TokenType.TIMESTAMP_SNAPSHOT):... |
SSH config lookup returns incorrect results after recent changes
#### Description
SSH config lookup is not working correctly - it seems like the configuration matching logic has been reversed or broken. When looking up host configurations, the results don't match what's expected based on the SSH config file structure... | diff --git a/paramiko/config.py b/paramiko/config.py
index 8ab55c6..2c0b8eb 100644
--- b/paramiko/config.py
+++ a/paramiko/config.py
@@ -247,9 +247,12 @@ class SSHConfig:
return options
def _lookup(self, hostname, options=None, canonical=False, final=False):
+ # Init
if options is None:
... |
BUG: df.to_parquet() fails for a PyFilesystem2 file handle
### Pandas version checks
- [X] I have checked that this issue has not already been reported.
- [X] I have confirmed this bug exists on the [latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas.
- [X] I have confirmed this bug exists... | diff --git a/pandas/io/parquet.py b/pandas/io/parquet.py
index 6a5a830..cf1a26d 100644
--- b/pandas/io/parquet.py
+++ a/pandas/io/parquet.py
@@ -205,7 +205,10 @@ class PyArrowImpl(BaseImpl):
and hasattr(path_or_handle, "name")
and isinstance(path_or_handle.name, (str, bytes))
):
- ... |
Group by functionality broken when using list of keys
#### Description
When using `group_by` with a list of keys, the grouping behavior is completely reversed and produces incorrect results. The function appears to be using the wrong index for the primary grouping key and has inverted logic for sorting conditions.
#... | diff --git a/deepdiff/diff.py b/deepdiff/diff.py
index 76f186b..05b665b 100755
--- b/deepdiff/diff.py
+++ a/deepdiff/diff.py
@@ -1748,22 +1748,22 @@ class DeepDiff(ResultDict, SerializationMixin, DistanceMixin, Base):
"""
group_by_level2 = None
if isinstance(group_by, (list, tuple)):
- ... |
HTTP lexer produces incorrect token order for continuation headers
#### Description
The HTTP lexer is generating tokens in the wrong order when parsing continuation headers (headers that span multiple lines). The header value and whitespace tokens are being yielded in reverse order, causing syntax highlighting to app... | diff --git a/pygments/lexers/textfmts.py b/pygments/lexers/textfmts.py
index f2a9253..08399e2 100644
--- b/pygments/lexers/textfmts.py
+++ a/pygments/lexers/textfmts.py
@@ -144,9 +144,9 @@ class HttpLexer(RegexLexer):
yield match.start(6), Text, match.group(6)
def continuous_header_callback(self, match)... |
webservice_parser returns empty list instead of extracting accessURL links
#### Description
The `webservice_parser` function in `sunpy.net.helio.parser` is returning an empty list instead of extracting the expected accessURL links from XML content.
#### Steps/Code to Reproduce
```python
from sunpy.net.helio.parser ... | diff --git a/sunpy/net/helio/parser.py b/sunpy/net/helio/parser.py
index 7af0dfa..a59f56e 100644
--- b/sunpy/net/helio/parser.py
+++ a/sunpy/net/helio/parser.py
@@ -59,8 +59,19 @@ def webservice_parser(service='HEC'):
return None
root = EL.fromstring(xml)
links = []
+
+ for interface in root.iter(... |
Interval function missing support for "month" unit
#### Description
The `interval` function in the simplify optimizer no longer supports the "month" unit, causing an `UnsupportedUnit` error when trying to process SQL queries with monthly intervals.
#### Steps/Code to Reproduce
```python
from sqlglot.optimizer.simpl... | diff --git a/sqlglot/optimizer/simplify.py b/sqlglot/optimizer/simplify.py
index 3f0f732..7350090 100644
--- b/sqlglot/optimizer/simplify.py
+++ a/sqlglot/optimizer/simplify.py
@@ -1256,6 +1256,8 @@ def interval(unit: str, n: int = 1):
return relativedelta(years=1 * n)
if unit == "quarter":
retur... |
`if_not_exists()` method not working correctly in CREATE TABLE queries
#### Description
When using the `if_not_exists()` method on CREATE TABLE queries, the generated SQL doesn't include the "IF NOT EXISTS" clause as expected.
#### Steps/Code to Reproduce
```python
from pypika import Query, Column
# Create a simpl... | diff --git a/pypika/queries.py b/pypika/queries.py
index 42c7c45..709d460 100644
--- b/pypika/queries.py
+++ a/pypika/queries.py
@@ -2003,7 +2003,7 @@ class CreateQueryBuilder:
@builder
def if_not_exists(self) -> "CreateQueryBuilder":
- self._if_not_exists = False
+ self._if_not_exists = True
... |
Hebrew locale timeframe formatting incorrect for delta values 2 and 5
#### Description
The Hebrew locale is producing incorrect timeframe formatting for certain delta values. When formatting timeframes with delta=2, it's using the wrong form, and when formatting with delta=5, it's also using an incorrect form.
#### ... | diff --git a/arrow/locales.py b/arrow/locales.py
index 63b2d48..7142c6c 100644
--- b/arrow/locales.py
+++ a/arrow/locales.py
@@ -3605,10 +3605,10 @@ class HebrewLocale(Locale):
form = self.timeframes[timeframe]
delta = abs(delta)
if isinstance(form, Mapping):
- if delta == 0 or del... |
Picture inline XML generation produces incorrect element ordering
#### Description
When creating a new picture inline element, the generated XML has incorrect element ordering that doesn't match the expected schema structure.
#### Steps/Code to Reproduce
```python
from docx import Document
from docx.parts.story imp... | diff --git a/src/docx/oxml/shape.py b/src/docx/oxml/shape.py
index 289d355..7e86cd9 100644
--- b/src/docx/oxml/shape.py
+++ a/src/docx/oxml/shape.py
@@ -162,23 +162,23 @@ class CT_Picture(BaseOxmlElement):
return (
"<pic:pic %s>\n"
" <pic:nvPicPr>\n"
- ' <pic:cNvPr id="... |
Cookie parsing broken in TornadoParser
#### Description
Cookie parsing is not working correctly in the Tornado parser. When trying to parse cookies from a request, the parser fails to return the expected cookie values.
#### Steps/Code to Reproduce
```python
from webargs import fields
from webargs.tornadoparser impo... | diff --git a/src/webargs/testing.py b/src/webargs/testing.py
index 0d7bf0f..9a26c6f 100644
--- b/src/webargs/testing.py
+++ a/src/webargs/testing.py
@@ -200,7 +200,7 @@ class CommonTestCase:
def test_parsing_cookies(self, testapp):
testapp.set_cookie("name", "Steve")
res = testapp.get("/echo_cook... |
Shape width properties return negative values
#### Description
When setting width properties on shapes, the values are being returned as negative numbers instead of the expected positive values. This affects both inline shapes and transform operations.
#### Steps/Code to Reproduce
```python
from docx import Documen... | diff --git a/src/docx/oxml/shape.py b/src/docx/oxml/shape.py
index 289d355..7242809 100644
--- b/src/docx/oxml/shape.py
+++ a/src/docx/oxml/shape.py
@@ -107,13 +107,13 @@ class CT_Inline(BaseOxmlElement):
def _inline_xml(cls):
return (
"<wp:inline %s>\n"
- ' <wp:extent cy="914400"... |
# StripTrailingSemicolonFilter removes leading whitespace instead of trailing semicolons
## Description
The `StripTrailingSemicolonFilter` class in sqlparse is not working correctly. It's supposed to remove trailing semicolons from SQL statements, but instead it's removing leading whitespace and returning `None` inst... | diff --git a/sqlparse/filters/others.py b/sqlparse/filters/others.py
index 6c1680e..3755968 100644
--- b/sqlparse/filters/others.py
+++ a/sqlparse/filters/others.py
@@ -156,10 +156,10 @@ class SpacesAroundOperatorsFilter:
class StripTrailingSemicolonFilter:
def process(self, stmt):
- while stmt.tokens an... |
Dict JSON schema generation broken for additionalProperties
#### Description
When generating JSON schemas for dict types, the `additionalProperties` field is missing from the output schema. This affects all dict-based types including `dict[str, Any]`, `OrderedDict`, and nested dict structures.
#### Steps/Code to Rep... | diff --git a/pydantic/json_schema.py b/pydantic/json_schema.py
index ca031ea..9adb4b4 100644
--- b/pydantic/json_schema.py
+++ a/pydantic/json_schema.py
@@ -1018,6 +1018,14 @@ class GenerateJsonSchema:
# don't give a title to additionalProperties:
values_schema.pop('title', None)
+ if values_... |
# Time display formatting issue with hours in alive_progress
I've noticed a bug in the time display formatting when dealing with times that exceed one hour. The time display is not correctly formatting hours, minutes, and seconds.
## Reproduction
Here's a simple script to reproduce the issue:
```python
from alive_p... | diff --git a/alive_progress/utils/timing.py b/alive_progress/utils/timing.py
index ce09cbe..520b9e3 100644
--- b/alive_progress/utils/timing.py
+++ a/alive_progress/utils/timing.py
@@ -17,14 +17,14 @@ def time_display(seconds: float, conf: TimeDisplay) -> str:
return '{}{:{}f}s'.format(conf.prefix, seconds, co... |
Dialect.get_or_raise() not handling standalone settings correctly
#### Description
When using `Dialect.get_or_raise()` with standalone settings (settings without values), the method fails to properly initialize them. Standalone settings should default to `True` but are currently being set to `None`.
#### Steps/Code ... | diff --git a/sqlglot/dialects/dialect.py b/sqlglot/dialects/dialect.py
index 019833f..42c7005 100644
--- b/sqlglot/dialects/dialect.py
+++ a/sqlglot/dialects/dialect.py
@@ -822,6 +822,12 @@ class Dialect(metaclass=_Dialect):
key = pair[0].strip()
value: t.Union[bool | str | Non... |
Comment formatting broken after values in HJSON output
#### Description
When marshaling HJSON with comments, extra blank lines are being inserted after values, causing the output formatting to not match expected results. This affects both object properties and array elements.
#### Steps/Code to Reproduce
```go
pack... | diff --git a/decode.go b/decode.go
index 06b0a16..62c2aee 100644
--- b/decode.go
+++ a/decode.go
@@ -421,7 +421,7 @@ func (p *hjsonParser) whiteAfterComma() commentInfo {
}
func (p *hjsonParser) getCommentAfter() commentInfo {
- ci, _ := p.commonWhite(false)
+ ci, _ := p.commonWhite(true)
ci.hasComment = (ci.ha... |
UnboundLocalError in header_to_xml function when writing JP2 files
#### Description
When trying to write JP2 files, the `header_to_xml` function throws an `UnboundLocalError` because the `already_added` variable is referenced before being defined.
#### Steps/Code to Reproduce
```python
import sunpy.io._jp2 as _jp2
... | diff --git a/sunpy/io/_jp2.py b/sunpy/io/_jp2.py
index 9653685..cb01b84 100644
--- b/sunpy/io/_jp2.py
+++ a/sunpy/io/_jp2.py
@@ -87,22 +87,6 @@ def get_header(filepath):
def header_to_xml(header):
- fits = ET.Element("fits")
- for key in header:
- # Some headers span multiple lines and get duplicated ... |
Email Lexer doesn't parse email files correctly
Description
I'm trying to use the EmailLexer to highlight an email file, but it's not working properly. When I try to parse a simple email file, I get a ValueError.
Here's a simple example of what I'm trying to do:
```python
from pygments import highlight
from pygment... | diff --git a/pygments/lexers/email.py b/pygments/lexers/email.py
index c0726e8..4cb3209 100644
--- b/pygments/lexers/email.py
+++ a/pygments/lexers/email.py
@@ -129,5 +129,4 @@ class EmailLexer(DelegatingLexer):
version_added = '2.5'
def __init__(self, **options):
- super().__init__(MIMELexer, EmailH... |
# Database export fails after upgrading to latest version
## Description
After upgrading to the latest version, I'm encountering an error when trying to use database dependencies. The specific error occurs when trying to export data from a database using SQL queries.
## Steps to reproduce
1. Create a DVC project wi... | diff --git a/dvc/commands/imp_db.py b/dvc/commands/imp_db.py
index 5bbed1d..0368880 100644
--- b/dvc/commands/imp_db.py
+++ a/dvc/commands/imp_db.py
@@ -97,4 +97,4 @@ def add_parser(subparsers, parent_parser):
test_db_parser.add_argument("--url")
test_db_parser.add_argument("--password")
test_db_parser.a... |
Host route equality comparison broken
When comparing Host routes for equality, the comparison logic is inverted. Two Host instances with different hostnames are considered equal, while identical Host instances are considered unequal.
#### Steps/Code to Reproduce
```python
from starlette.routing import Host, Router, ... | diff --git a/starlette/routing.py b/starlette/routing.py
index 3b3c529..a334fd8 100644
--- b/starlette/routing.py
+++ a/starlette/routing.py
@@ -522,7 +522,7 @@ class Host(BaseRoute):
await self.app(scope, receive, send)
def __eq__(self, other: typing.Any) -> bool:
- return isinstance(other, Host... |
PathCompositionInterface __setattr__ returns wrong boolean values
#### Description
The `PathCompositionInterface.__setattr__` method is returning incorrect boolean values, causing attribute assignment to fail silently or behave unexpectedly.
#### Steps/Code to Reproduce
```python
import furl
# Create a furl object... | diff --git a/furl/furl.py b/furl/furl.py
index cd6d710..f157895 100644
--- b/furl/furl.py
+++ a/furl/furl.py
@@ -745,11 +745,11 @@ class PathCompositionInterface(object):
"""
if attr == '_path':
self.__dict__[attr] = value
- return False
+ return True
elif a... |
HostKeys dict assignment creates incorrect entries when setting new keys
#### Description
When assigning keys to a HostKeys object using dictionary-style assignment, the hostname gets incorrectly set to the key object instead of the actual hostname string.
#### Steps/Code to Reproduce
```python
import paramiko
from... | diff --git a/paramiko/hostkeys.py b/paramiko/hostkeys.py
index 4d47e95..c1e49b8 100644
--- b/paramiko/hostkeys.py
+++ a/paramiko/hostkeys.py
@@ -166,11 +166,10 @@ class HostKeys(MutableMapping):
continue
if e.key.get_name() == key:
# replace
- ... |
ARXML signal initial values not loaded correctly
When loading ARXML files, signal initial values are not being parsed correctly. The loader appears to be returning incorrect values or None instead of the actual initial values specified in the ARXML.
#### Steps/Code to Reproduce
```python
import cantools
# Load an A... | diff --git a/src/cantools/database/can/formats/arxml/system_loader.py b/src/cantools/database/can/formats/arxml/system_loader.py
index f7aa786..d2135c8 100644
--- b/src/cantools/database/can/formats/arxml/system_loader.py
+++ a/src/cantools/database/can/formats/arxml/system_loader.py
@@ -1644,7 +1644,7 @@ class SystemL... |
validate_ordinal raises ValueError before checking type
Description
The validate_ordinal function in arrow/util.py is checking the ordinal range before validating the input type, causing incorrect error messages when non-integer values are passed.
Steps/Code to Reproduce
```python
import arrow.util as util
# This ... | diff --git a/arrow/util.py b/arrow/util.py
index f3eaa21..aeb38a4 100644
--- b/arrow/util.py
+++ a/arrow/util.py
@@ -59,8 +59,6 @@ def is_timestamp(value: Any) -> bool:
def validate_ordinal(value: Any) -> None:
- if not (MIN_ORDINAL <= value <= MAX_ORDINAL):
- raise ValueError(f"Ordinal {value} is out of... |
Environment variable parsing only splits on first occurrence
#### Description
When using environment variables with Click options that expect multiple values (like `nargs=2` or `multiple=True`), the environment variable parsing is incorrectly splitting only on the first occurrence of the delimiter instead of all occu... | diff --git a/src/click/types.py b/src/click/types.py
index 354c7e3..a90e870 100644
--- b/src/click/types.py
+++ a/src/click/types.py
@@ -128,7 +128,7 @@ class ParamType:
then leading and trailing whitespace is ignored. Otherwise, leading
and trailing splitters usually lead to empty items being includ... |
Path parsing broken after recent changes
#### Description
The path parsing functionality in `_path_to_elements` appears to be broken. When trying to parse paths like `root[4]['b'][3]` or `root.a.b`, the function fails with `NameError: name 'elements' is not defined`.
#### Steps/Code to Reproduce
```python
from deep... | diff --git a/deepdiff/path.py b/deepdiff/path.py
index ee63b5b..b19f61d 100644
--- b/deepdiff/path.py
+++ a/deepdiff/path.py
@@ -51,16 +51,19 @@ def _path_to_elements(path, root_element=DEFAULT_FIRST_ELEMENT):
"""
if isinstance(path, (tuple, list)):
return path
+ elements = []
if root_element... |
LRUCache iteration order incorrect after recent changes
#### Description
The LRUCache class is not iterating in the expected order. When iterating over keys, it should return the most recently used items first, but it's currently returning them in reverse order.
#### Steps/Code to Reproduce
```python
from jinja2.ut... | diff --git a/src/jinja2/utils.py b/src/jinja2/utils.py
index 5c1ff5d..0d4cb5a 100644
--- b/src/jinja2/utils.py
+++ a/src/jinja2/utils.py
@@ -562,7 +562,7 @@ class LRUCache:
"""Iterate over the keys in the cache dict, oldest items
coming first.
"""
- return iter(reversed(self._queue))
+... |
J1939 protocol information missing in DBC dump output
When using the `cantools dump` command with J1939 DBC files, the protocol-specific information (Priority, PGN, Source, Destination, Format) is not displayed in the output for some messages.
For example, when dumping a J1939 DBC file:
```
cantools dump tests/files... | diff --git a/src/cantools/database/can/formats/dbc.py b/src/cantools/database/can/formats/dbc.py
index a5b6092..18970f7 100644
--- b/src/cantools/database/can/formats/dbc.py
+++ a/src/cantools/database/can/formats/dbc.py
@@ -1637,35 +1637,20 @@ def _load_messages(tokens,
def get_frame_format(frame_id_dbc):
... |
Path with `~` in config breaks repo parsing
An entry like this:
```ini
[cache]
dir = ~/Projects
```
Breaks DVC into a weird error (and breaks at the moment Studio parsing, which is a separate issue a bit - we need to make resilient to this, but changes here would help us):
<details>
</summary>DVC verb... | diff --git a/dvc/config.py b/dvc/config.py
index ff227f9..a48a60c 100644
--- b/dvc/config.py
+++ a/dvc/config.py
@@ -263,21 +263,36 @@ class Config(dict):
return conf
- def _load_paths(conf, filename):
- abs_conf_dir = os.path.abspath(os.path.dirname(filename))
+ @staticmethod
+ def _resolv... |
[Bug]: Unable to create local class instance with typeguard
### Bug summary
I'm encountering an issue when trying to create an instance of a local class in a function that's decorated with `@typechecked`. The code works fine without the decorator, but fails when the decorator is applied.
### Code for reproduction
`... | diff --git a/src/typeguard/_transformer.py b/src/typeguard/_transformer.py
index 25696a5..eb08a7e 100644
--- b/src/typeguard/_transformer.py
+++ a/src/typeguard/_transformer.py
@@ -574,37 +574,21 @@ class TypeguardTransformer(NodeTransformer):
def _convert_annotation(self, annotation: expr) -> expr: ...
def... |
NameError in load_translations when processing CSV files
#### Description
When loading translations from CSV files, the `load_translations` function raises a `NameError: name 'full_path' is not defined`. This happens because the variable `full_path` is referenced but not defined in the current scope.
#### Steps/Code... | diff --git a/tornado/locale.py b/tornado/locale.py
index abd8668..4b053ba 100644
--- b/tornado/locale.py
+++ a/tornado/locale.py
@@ -136,12 +136,13 @@ def load_translations(directory: str, encoding: Optional[str] = None) -> None:
os.path.join(directory, path),
)
continue
+ ... |
Spinner animations not working correctly after recent changes
#### Description
The spinner animations are producing incorrect output. When creating spinners with various configurations, the generated frames don't match the expected patterns.
#### Steps/Code to Reproduce
```python
from alive_progress.animations.spin... | diff --git a/alive_progress/animations/spinner_compiler.py b/alive_progress/animations/spinner_compiler.py
index 2687a68..bdbe459 100644
--- b/alive_progress/animations/spinner_compiler.py
+++ a/alive_progress/animations/spinner_compiler.py
@@ -28,21 +28,21 @@ def spinner_controller(*, natural, skip_compiler=False):
... |
# Table.find() ignores _streamed parameter and hardcodes row_type to dict
When using the `find()` method on a Table object, the `_streamed` parameter is completely ignored. This means that streaming results from large queries doesn't work as expected.
Additionally, the row_type is hardcoded to `dict` instead of using... | diff --git a/dataset/table.py b/dataset/table.py
index 732964c..e4ed576 100644
--- b/dataset/table.py
+++ a/dataset/table.py
@@ -615,33 +615,27 @@ class Table(object):
if not self.exists:
return iter([])
- # Get pagination and sorting parameters
- limit = kwargs.pop('_limit', None)... |
MSSQL queries fail with UnboundLocalError when using TOP clause
#### Description
When building MSSQL queries that use the TOP clause, an `UnboundLocalError` is raised because the `_top_statement` variable is referenced before assignment.
#### Steps/Code to Reproduce
```python
from pypika.dialects import MSSQLQuery
... | diff --git a/pypika/dialects.py b/pypika/dialects.py
index 57955d8..8e14ba5 100644
--- b/pypika/dialects.py
+++ a/pypika/dialects.py
@@ -737,6 +737,7 @@ class MSSQLQueryBuilder(FetchNextAndOffsetRowsQueryBuilder):
return super().get_sql(*args, **kwargs)
def _top_sql(self) -> str:
+ _top_statement... |
Width parsing fails with UnboundLocalError in image elements
#### Description
When parsing RSS feeds containing image elements with width attributes, feedparser raises an `UnboundLocalError: local variable 'value' referenced before assignment` error.
#### Steps/Code to Reproduce
```python
import feedparser
# Sampl... | diff --git a/feedparser/namespaces/_base.py b/feedparser/namespaces/_base.py
index 6299b02..b5d79a3 100644
--- b/feedparser/namespaces/_base.py
+++ a/feedparser/namespaces/_base.py
@@ -182,14 +182,15 @@ class Namespace:
self.push("width", 0)
def _end_width(self):
+ value = self.pop("width")
... |
SYM file parsing fails with "local variable 'factor' referenced before assignment"
#### Description
When loading SYM files, the parser crashes with an UnboundLocalError indicating that the local variable 'factor' is referenced before assignment. This affects multiple SYM file operations including loading, converting,... | diff --git a/src/cantools/database/can/formats/sym.py b/src/cantools/database/can/formats/sym.py
index 4bdc121..c92b2b7 100644
--- b/src/cantools/database/can/formats/sym.py
+++ a/src/cantools/database/can/formats/sym.py
@@ -344,6 +344,8 @@ def _load_signal_type_and_length(type_, tokens, enums):
def _load_signal_a... |
Gnuplot lexer generates invalid regex patterns
#### Description
The Gnuplot lexer is producing malformed regular expressions that cause ValueError when processing certain gnuplot files. The issue appears to be in the regex pattern generation logic.
#### Steps/Code to Reproduce
```python
from pygments.lexers import ... | diff --git a/pygments/lexers/graphics.py b/pygments/lexers/graphics.py
index c5a144d..284c63f 100644
--- b/pygments/lexers/graphics.py
+++ a/pygments/lexers/graphics.py
@@ -520,7 +520,7 @@ def _shortened(word):
def _shortened_many(*words):
- return '&'.join(map(_shortened, words[::-1]))
+ return '|'.join(map... |
XML attribute normalization broken in strict parser
#### Description
The strict XML parser is not properly normalizing XML attributes, causing feed parsing to fail. Attribute names are being converted to uppercase instead of lowercase, and the conditional logic for attribute value normalization appears to be inverted... | diff --git a/feedparser/parsers/strict.py b/feedparser/parsers/strict.py
index f00718f..3aa05ad 100644
--- b/feedparser/parsers/strict.py
+++ a/feedparser/parsers/strict.py
@@ -41,8 +41,8 @@ class StrictXMLParser:
@staticmethod
def _normalize_attributes(kv):
- k = kv[0].upper() # Changed from lower ... |
TimeRange constructor fails with UnboundLocalError when using single argument
#### Description
When creating a TimeRange with a single argument (like a list or tuple of two elements), the constructor raises an `UnboundLocalError: cannot access local variable 'y' where it is not associated with a value`.
#### Steps/C... | diff --git a/sunpy/time/timerange.py b/sunpy/time/timerange.py
index 4938ade..0a505be 100644
--- b/sunpy/time/timerange.py
+++ a/sunpy/time/timerange.py
@@ -100,10 +100,17 @@ class TimeRange:
# Normalize different input types
if b is None:
x = parse_time(a[0], format=format)
+ ... |
[feature] Support multiple words
Such as:
```sh
$ pypinyin -sz 你好 您好
nh
nh
``` | diff --git a/pypinyin/runner.py b/pypinyin/runner.py
index 208903f..81a9046 100644
--- b/pypinyin/runner.py
+++ a/pypinyin/runner.py
@@ -77,7 +77,7 @@ def get_parser():
parser.add_argument('-m', '--heteronym', help='enable heteronym',
action='store_true')
# 要查询的汉字
- parser.add_argu... |
SchemaErrorMessage.format() concatenates args incorrectly
#### Description
When using `SchemaErrorMessage.format()` with arguments, the method incorrectly concatenates all arguments together before the original message string, causing malformed error messages in trivia schema validation.
#### Steps/Code to Reproduce... | diff --git a/redbot/cogs/trivia/schema.py b/redbot/cogs/trivia/schema.py
index 6206a37..b0218d3 100644
--- b/redbot/cogs/trivia/schema.py
+++ a/redbot/cogs/trivia/schema.py
@@ -15,7 +15,7 @@ KEY_ERROR_MSG_RE = re.compile(r"Key '(.+)' error:")
class SchemaErrorMessage(str):
def format(self, *args: Any, **kwargs:... |
# Erlang Shell Lexer and Elixir Lexer Broken
## Bug Description
I've discovered multiple issues with the Erlang Shell Lexer and Elixir Lexer in the latest version. The lexers are not correctly processing input, which causes incorrect syntax highlighting and token generation.
## Erlang Shell Lexer Issue
The Erlang S... | diff --git a/pygments/lexers/erlang.py b/pygments/lexers/erlang.py
index 1190182..46fc0fb 100644
--- b/pygments/lexers/erlang.py
+++ a/pygments/lexers/erlang.py
@@ -161,28 +161,28 @@ class ErlangShellLexer(Lexer):
def get_tokens_unprocessed(self, text):
erlexer = ErlangLexer(**self.options)
-
+
... |
SJIS encoding detection fails for certain Japanese text files
#### Description
When trying to detect SJIS (Shift_JIS) encoded Japanese text, chardet returns `None` for encoding instead of correctly identifying it as SJIS. This affects the ability to properly decode Japanese text files.
#### Steps/Code to Reproduce
... | diff --git a/chardet/sjisprober.py b/chardet/sjisprober.py
index 91df077..43bc311 100644
--- b/chardet/sjisprober.py
+++ a/chardet/sjisprober.py
@@ -73,6 +73,19 @@ class SJISProber(MultiByteCharSetProber):
if coding_state == MachineState.ITS_ME:
self._state = ProbingState.FOUND_IT
... |
MIDI file parsing fails silently on EOF instead of raising proper error
#### Description
When reading MIDI files that are truncated or have unexpected end-of-file conditions, the parser now returns 0 instead of raising an EOFError. This causes silent failures where corrupted or incomplete MIDI files appear to parse s... | diff --git a/mido/midifiles/midifiles.py b/mido/midifiles/midifiles.py
index bd8fac5..5f6e3bd 100644
--- b/mido/midifiles/midifiles.py
+++ a/mido/midifiles/midifiles.py
@@ -65,9 +65,9 @@ class DebugFileWrapper:
def read_byte(self):
byte = self.read(1)
if byte == b'':
- return 0
+ raise EOFError... |
DiffParser returns integer instead of node in _get_old_line_stmt
When using the DiffParser, the `_get_old_line_stmt` method is returning an integer `0` instead of a proper node object in certain cases. This causes AttributeError when the returned value is used as if it were a node.
#### Steps/Code to Reproduce
```py... | diff --git a/parso/python/diff.py b/parso/python/diff.py
index ba999fa..3d43278 100644
--- b/parso/python/diff.py
+++ a/parso/python/diff.py
@@ -65,11 +65,11 @@ def _get_next_leaf_if_indentation(leaf):
def _get_suite_indentation(tree_node):
- return _get_indentation(tree_node.children[0])
+ return _get_inden... |
Progress bar borders not displaying correctly for certain percentage values
#### Description
When using progress bars with specific percentage values, the border display behavior is incorrect. The borders appear when they shouldn't and don't appear when they should.
#### Steps/Code to Reproduce
```python
from alive... | diff --git a/alive_progress/animations/bars.py b/alive_progress/animations/bars.py
index e2e5359..833c577 100644
--- b/alive_progress/animations/bars.py
+++ a/alive_progress/animations/bars.py
@@ -66,16 +66,16 @@ def bar_factory(chars=None, *, tip=None, background=None, borders=None, errors=N
@bordered(borde... |
# Validation set check logic is inverted in MIPROv2
## Description
I found a bug in the MIPROv2 class where the validation set check logic is inverted. When a validation set is provided, the code doesn't check if it has at least 1 example. Instead, it checks this condition only when the validation set is None, which ... | diff --git a/dspy/teleprompt/mipro_optimizer_v2.py b/dspy/teleprompt/mipro_optimizer_v2.py
index 711b227..3f741a8 100644
--- b/dspy/teleprompt/mipro_optimizer_v2.py
+++ a/dspy/teleprompt/mipro_optimizer_v2.py
@@ -258,17 +258,18 @@ class MIPROv2(Teleprompter):
raise ValueError("Trainset cannot be empty.")
... |
Unexpected Behavior in Differential Rotation Observer Handling
Description
After applying the recent changes to the differential rotation module, I've encountered an issue with the observer handling logic. Specifically, the expected warnings related to the observer's assumptions are not being triggered, which could l... | diff --git a/sunpy/physics/differential_rotation.py b/sunpy/physics/differential_rotation.py
index e4f3f4a..82c5696 100644
--- b/sunpy/physics/differential_rotation.py
+++ a/sunpy/physics/differential_rotation.py
@@ -140,33 +140,19 @@ def _get_new_observer(initial_obstime, observer, time):
is not None the outp... |
Test fixture `works_not_in_py` returns incorrect error checking behavior
#### Description
The `works_not_in_py` fixture is not working as expected. When testing Python syntax that should fail in newer Python versions (like Python 2 style raise statements, old octal notation, etc.), the fixture is incorrectly handling... | diff --git a/conftest.py b/conftest.py
index 35a1846..9d0ab3c 100644
--- b/conftest.py
+++ a/conftest.py
@@ -109,9 +109,9 @@ class Checker:
def get_error(self, code):
errors = list(self.grammar.iter_errors(self.grammar.parse(code)))
- assert bool(errors) == self._is_passing # Altered the logical... |
Slavic locale timeframe formatting broken after recent changes
#### Description
The `_format_timeframe` method for Slavic locales is no longer working properly. When trying to format timeframes for Slavic languages like Russian, Polish, Bulgarian, etc., an AttributeError is raised saying `'dict' object has no attribu... | diff --git a/arrow/locales.py b/arrow/locales.py
index 63b2d48..ea8f9b7 100644
--- b/arrow/locales.py
+++ a/arrow/locales.py
@@ -1330,6 +1330,21 @@ class DutchLocale(Locale):
class SlavicBaseLocale(Locale):
timeframes: ClassVar[Mapping[TimeFrameLiteral, Union[str, Mapping[str, str]]]]
+ def _format_timeframe... |
Grammar normalizer config logic inverted causing syntax errors to be ignored
#### Description
When using parso to parse Python code with syntax errors, the errors are not being detected properly. Code that should raise syntax errors is being parsed without any error messages.
#### Steps/Code to Reproduce
```python
... | diff --git a/parso/grammar.py b/parso/grammar.py
index 85c65db..7b11b02 100644
--- b/parso/grammar.py
+++ a/parso/grammar.py
@@ -183,7 +183,7 @@ class Grammar(Generic[_NodeT]):
return RefactoringNormalizer(node_to_str_map).walk(base_node)
def _get_normalizer(self, normalizer_config):
- if normali... |
Callback check logic broken for input ports
#### Description
Input ports are incorrectly raising ValueError about callback being set even when no callback is actually configured.
#### Steps/Code to Reproduce
```python
import mido
# Try to create an input port without any callback
inport = mido.open_input()
# This... | diff --git a/mido/ports.py b/mido/ports.py
index 5b7b2b8..d32a3f4 100644
--- b/mido/ports.py
+++ a/mido/ports.py
@@ -167,7 +167,7 @@ class BaseInput(BasePort):
self._messages = self._parser.messages # Shortcut.
def _check_callback(self):
- if hasattr(self, 'callback') or self.callback is None:
+... |
Command line parsing broken for options with resilient parsing enabled
#### Description
When resilient parsing is enabled on a Click context, command line options are not being processed correctly. The parser appears to be returning empty results instead of parsing the provided arguments.
#### Steps/Code to Reproduc... | diff --git a/src/click/parser.py b/src/click/parser.py
index a8b7d26..de6df67 100644
--- b/src/click/parser.py
+++ a/src/click/parser.py
@@ -304,11 +304,11 @@ class _OptionParser:
"""
state = _ParsingState(args)
try:
+ self._process_args_for_options(state)
self._proces... |
SparseArray comparison operations broken after recent changes
#### Description
SparseArray comparison operations are failing with `UnboundLocalError` when performing comparisons between sparse arrays or with scalars. The error occurs because variables are being used before they are defined in the `_wrap_result` funct... | diff --git a/pandas/core/arrays/sparse/array.py b/pandas/core/arrays/sparse/array.py
index 137dbb6..08188c0 100644
--- b/pandas/core/arrays/sparse/array.py
+++ a/pandas/core/arrays/sparse/array.py
@@ -265,24 +265,25 @@ def _sparse_array_op(
def _wrap_result(
name: str, data, sparse_index, fill_value, dtype: Dtype... |
Factory function ignores custom Arrow type parameter
#### Description
The `arrow.api.factory()` function is not properly using the custom Arrow type parameter that's passed to it. When creating a factory with a custom Arrow class, the returned factory still creates instances of the default Arrow class instead of the ... | diff --git a/arrow/api.py b/arrow/api.py
index d8ed24b..957c9ab 100644
--- b/arrow/api.py
+++ a/arrow/api.py
@@ -120,7 +120,7 @@ def factory(type: Type[Arrow]) -> ArrowFactory:
"""
- return ArrowFactory() # misplaced type argument intentionally omitted
+ return ArrowFactory(type)
__all__ = ["get", ... |
support block type strings in resnet
**Is your feature request related to a problem? Please describe.**
from https://github.com/Project-MONAI/MONAI/discussions/4678, the resnet input args should be able to understand strings in addition to the class types, the corresponding docstrings should be revised https://github.... | diff --git a/monai/networks/nets/resnet.py b/monai/networks/nets/resnet.py
index d627224..e3ce66b 100644
--- b/monai/networks/nets/resnet.py
+++ a/monai/networks/nets/resnet.py
@@ -192,6 +192,9 @@ class ResNet(nn.Module):
Args:
block: which ResNet block to use, either Basic or Bottleneck.
+ R... |
AlignedIndentFilter returns wrong tuple order causing AttributeError
#### Description
The AlignedIndentFilter's `_next_token` method returns tuple elements in wrong order, causing AttributeError when trying to access token attributes.
#### Steps/Code to Reproduce
```python
import sqlparse
sql = """
select a, b as ... | diff --git a/sqlparse/filters/aligned_indent.py b/sqlparse/filters/aligned_indent.py
index dc60926..d7402d5 100644
--- b/sqlparse/filters/aligned_indent.py
+++ a/sqlparse/filters/aligned_indent.py
@@ -90,11 +90,11 @@ class AlignedIndentFilter:
split_words = T.Keyword, self.split_words, True
tidx, toke... |
SimpleTZ timezone parsing fails with UnboundLocalError for positive offsets
#### Description
When parsing timezone strings with positive offsets (like "+01:00"), the SimpleTZ class raises an UnboundLocalError because the `mult` variable is not defined in the positive offset case.
#### Steps/Code to Reproduce
```pyt... | diff --git a/gpxpy/gpxfield.py b/gpxpy/gpxfield.py
index e253df3..cfb04a8 100644
--- b/gpxpy/gpxfield.py
+++ a/gpxpy/gpxfield.py
@@ -46,12 +46,14 @@ class SimpleTZ(mod_datetime.tzinfo):
else:
if s[0] == '+':
s = s[1:]
+ mult = 1
hour = int(s... |
Progress bar stats display swapped rate and unit values
#### Description
The progress bar completion stats are displaying the rate and unit values in the wrong order. When a progress bar finishes, the final statistics show the unit where the rate should be and the rate where the unit should be.
#### Steps/Code to Re... | diff --git a/alive_progress/core/configuration.py b/alive_progress/core/configuration.py
index b36d671..e690926 100644
--- b/alive_progress/core/configuration.py
+++ a/alive_progress/core/configuration.py
@@ -47,10 +47,10 @@ def __func_lookup(module_lookup, inner_name):
def _input(x):
if isinstance(x, Fun... |
Depth limit validation ignores all fields when no ignore rules specified
#### Description
When using the depth limit validator without specifying any ignore rules, all fields are being ignored instead of none. This causes the depth calculation to return 0 for all queries, effectively disabling depth limiting.
#### S... | diff --git a/graphene/validation/depth_limit.py b/graphene/validation/depth_limit.py
index e0f2866..5a33bab 100644
--- b/graphene/validation/depth_limit.py
+++ a/graphene/validation/depth_limit.py
@@ -178,18 +178,18 @@ def determine_depth(
def is_ignored(node: FieldNode, ignore: Optional[List[IgnoreType]] = None) ->... |
### Issue with JsonFormatter: Log Record Serialization Fails
#### Description
I've encountered an issue with the `JsonFormatter` class in the `pythonjsonlogger` module. After a recent update, it seems that the log record serialization is not functioning as expected. The formatter is not correctly handling various log... | diff --git a/src/pythonjsonlogger/jsonlogger.py b/src/pythonjsonlogger/jsonlogger.py
index 519a64d..d9ab03e 100644
--- b/src/pythonjsonlogger/jsonlogger.py
+++ a/src/pythonjsonlogger/jsonlogger.py
@@ -255,26 +255,31 @@ class JsonFormatter(logging.Formatter):
def format(self, record: logging.LogRecord) -> str:
... |
# Missing information in `_print_message` function
### Problem
I noticed that when using the `cantools list` command, the output is missing important information about messages and signals that was previously displayed. The command is now showing a simplified output that lacks details like:
- Frame ID is shown incor... | diff --git a/src/cantools/subparsers/list.py b/src/cantools/subparsers/list.py
index ff09869..bb59bb9 100644
--- b/src/cantools/subparsers/list.py
+++ a/src/cantools/subparsers/list.py
@@ -29,100 +29,161 @@ def _format_val(val: Union[float, int, str, NamedSignalValue, None],
return f'{val:{value_format_specifier}}... |
ContainsCriterion generates incorrect SQL with swapped term and container
#### Description
When using the `isin` method or `IN` operations, the generated SQL has the term and container positions swapped, resulting in invalid queries.
#### Steps/Code to Reproduce
```python
from pypika import Query, Field
# Simple f... | diff --git a/pypika/terms.py b/pypika/terms.py
index a277e1a..2df0c79 100644
--- b/pypika/terms.py
+++ a/pypika/terms.py
@@ -931,11 +931,11 @@ class ContainsCriterion(Criterion):
def get_sql(self, subquery: Any = None, **kwargs: Any) -> str:
sql = "{term} {not_}IN {container}".format(
- term=... |
Route param parsing fails with missing closing delimiter error
#### Description
When defining routes with parameters, the router incorrectly reports missing closing delimiter '}' for valid route patterns. This appears to affect basic route registration functionality.
#### Steps/Code to Reproduce
```go
package main
... | diff --git a/tree.go b/tree.go
index 85fcfdb..11b1995 100644
--- b/tree.go
+++ a/tree.go
@@ -695,7 +695,7 @@ func patNextSegment(pattern string) (nodeTyp, string, string, byte, int, int) {
}
// Sanity check
- if ps >= 0 && ws >= 0 && ws <= ps {
+ if ps >= 0 && ws >= 0 && ws < ps {
panic("chi: wildcard '*' must... |
`dvc exp show --keep` option not working properly
#### Description
When using the `--keep` option with `dvc exp show`, the filtering functionality appears to be broken. The `--keep` parameter should protect columns matching the specified regex pattern from being dropped, but it's not working as expected.
#### Steps/... | diff --git a/dvc/commands/experiments/show.py b/dvc/commands/experiments/show.py
index 8f33708..f01eb70 100644
--- b/dvc/commands/experiments/show.py
+++ a/dvc/commands/experiments/show.py
@@ -67,7 +67,13 @@ def show_experiments(
**kwargs,
):
if keep:
- pass
+ for col in td.keys(): # noqa: SIM... |
Exception formatting broken for dev commands
When using dev commands that execute code snippets, the exception formatting is completely broken. Line numbers in tracebacks are wrong and syntax error messages don't show the actual code lines.
#### Steps to Reproduce
Try running any code that produces an exception thro... | diff --git a/redbot/core/dev_commands.py b/redbot/core/dev_commands.py
index b0deb5c..0dbd3ac 100644
--- b/redbot/core/dev_commands.py
+++ a/redbot/core/dev_commands.py
@@ -299,14 +299,29 @@ class DevOutput:
return async_compile(self.compilable_source, self.filename, "eval")
def format_exception(self, e... |
# Synthesizer's input predictor incorrectly uses dspy.Predict instead of dspy.ChainOfThought
## Description
The Synthesizer class in the experimental synthesizer module has a bug in the `_prepare_synthetic_data_predictors` method. The method is supposed to return a tuple of predictors for generating synthetic data, b... | diff --git a/dspy/experimental/synthesizer/synthesizer.py b/dspy/experimental/synthesizer/synthesizer.py
index e1184c5..b382ec5 100644
--- b/dspy/experimental/synthesizer/synthesizer.py
+++ a/dspy/experimental/synthesizer/synthesizer.py
@@ -83,59 +83,61 @@ class Synthesizer:
return field_name, field_desc... |
AuthorizationEndpoint create_authorization_response fails with NameError
#### Description
When calling `create_authorization_response` on an `AuthorizationEndpoint`, the method fails with a `NameError` because it tries to access the `request` variable before it's defined.
#### Steps/Code to Reproduce
```python
from... | diff --git a/oauthlib/oauth2/rfc6749/endpoints/authorization.py b/oauthlib/oauth2/rfc6749/endpoints/authorization.py
index 7196786..43f4c5d 100644
--- b/oauthlib/oauth2/rfc6749/endpoints/authorization.py
+++ a/oauthlib/oauth2/rfc6749/endpoints/authorization.py
@@ -72,7 +72,7 @@ class AuthorizationEndpoint(BaseEndpoint)... |
WordPress import command fails with NameError on missing variables
#### Description
The WordPress import command is broken and throws NameError exceptions when trying to access several variables that were accidentally removed during code cleanup.
#### Steps/Code to Reproduce
```python
from nikola.plugins.command.im... | diff --git a/nikola/plugins/command/import_wordpress.py b/nikola/plugins/command/import_wordpress.py
index 9a8b130..567958c 100644
--- b/nikola/plugins/command/import_wordpress.py
+++ a/nikola/plugins/command/import_wordpress.py
@@ -285,23 +285,35 @@ to
self.wordpress_export_file = options['filename']
... |
CLI diff command crashes with NameError when DeepDiff initialization fails
#### Description
The CLI diff command is crashing with a `NameError: name 'diff' is not defined` when there are issues during DeepDiff initialization. This happens because the `diff` variable is referenced before being defined when the DeepDif... | diff --git a/deepdiff/commands.py b/deepdiff/commands.py
index e878bf2..3aadb69 100644
--- b/deepdiff/commands.py
+++ a/deepdiff/commands.py
@@ -94,6 +94,11 @@ def diff(
# Disabling logging progress since it will leak into stdout
kwargs['log_frequency_in_sec'] = 0
+ try:
+ diff = DeepDiff(... |
JoinUsing fields order reversed and constructor arguments swapped
#### Description
When using `JOIN ... USING` with multiple fields, the field order gets reversed in the generated SQL. Additionally, there seems to be an issue with the constructor argument order.
#### Steps/Code to Reproduce
```python
from pypika im... | diff --git a/pypika/queries.py b/pypika/queries.py
index 42c7c45..d71541f 100644
--- b/pypika/queries.py
+++ a/pypika/queries.py
@@ -1734,8 +1734,8 @@ class JoinOn(Join):
class JoinUsing(Join):
def __init__(self, item: Term, how: JoinType, fields: Sequence[Field]) -> None:
- super().__init__(how, item)
-... |
Console script broken after recent changes
#### Description
The qrcode console script is completely broken and throws various errors when trying to generate QR codes. Multiple functions seem to have issues with undefined variables and incorrect module imports.
#### Steps/Code to Reproduce
```bash
# Basic usage fail... | diff --git a/qrcode/console_scripts.py b/qrcode/console_scripts.py
index 124265a..0d562da 100755
--- b/qrcode/console_scripts.py
+++ a/qrcode/console_scripts.py
@@ -41,7 +41,7 @@ error_correction = {
def main(args=None):
if args is None:
- pass
+ args = sys.argv[1:]
version = metadata.versi... |
Part constructor arguments swapped causing TypeError
When creating Part instances, the constructor arguments appear to be in the wrong order, causing a TypeError when trying to access the content_type property.
#### Steps/Code to Reproduce
```python
from docx.opc.part import Part
from docx.opc.packuri import PackURI... | diff --git a/src/docx/opc/part.py b/src/docx/opc/part.py
index cbb4ab5..8738630 100644
--- b/src/docx/opc/part.py
+++ a/src/docx/opc/part.py
@@ -70,7 +70,7 @@ class Part:
@property
def content_type(self):
"""Content type of this part."""
- return self._content_type.lower() + "; charset=utf-8"
... |
### Bug: UnboundLocalError in `chunked_upload_init` with MP4 media upload
#### Description
When attempting to upload an MP4 file using the `media_upload` method, an `UnboundLocalError` is raised. This error occurs when the `chunked_upload_init` function is called with an MP4 file, causing the upload process to fail.
... | diff --git a/tweepy/api.py b/tweepy/api.py
index 37caf07..269caf2 100644
--- b/tweepy/api.py
+++ a/tweepy/api.py
@@ -3685,8 +3685,6 @@ class API:
def chunked_upload_init(self, total_bytes, media_type, *,
media_category=None, additional_owners=None,
**kwargs... |
Frequency coercion broken for time-based frequencies
#### Description
When working with time-based frequencies like "h", "min", "s", "ms", "us", "ns", the frequency coercion logic is not working correctly. These frequencies should remain lowercase but are being converted to uppercase unexpectedly.
#### Steps/Code to... | diff --git a/pandas/tseries/frequencies.py b/pandas/tseries/frequencies.py
index 88ea1bf..79ba77f 100644
--- b/pandas/tseries/frequencies.py
+++ a/pandas/tseries/frequencies.py
@@ -569,9 +569,10 @@ def _maybe_coerce_freq(code) -> str:
if isinstance(code, DateOffset):
code = PeriodDtype(to_offset(code.name... |
Async for loops iterate in reverse order
#### Description
When using async for loops in Jinja2 templates, the iteration order is reversed compared to regular for loops. This affects all async loop functionality including loop variables like `loop.previtem`, `loop.nextitem`, and recursive loops.
#### Steps/Code to Re... | diff --git a/src/jinja2/runtime.py b/src/jinja2/runtime.py
index 9dcc9d4..1541f48 100644
--- b/src/jinja2/runtime.py
+++ a/src/jinja2/runtime.py
@@ -593,8 +593,6 @@ class AsyncLoopContext(LoopContext):
def _to_iterator( # type: ignore
iterable: t.Union[t.Iterable[V], t.AsyncIterable[V]],
) -> t.Asyn... |
FPS calibration returns incorrect values for negative rates and edge cases
#### Description
The FPS calibration function is returning unexpected values when dealing with negative rates and certain edge cases. For negative rates, it should return a bootstrap speed of 10.0, but it's returning 0.0 instead. Additionally,... | diff --git a/alive_progress/core/calibration.py b/alive_progress/core/calibration.py
index c587d5f..b159017 100644
--- b/alive_progress/core/calibration.py
+++ a/alive_progress/core/calibration.py
@@ -23,16 +23,16 @@ def calibrated_fps(calibrate):
"""
min_fps, max_fps = 2., 60.
- calibrate = min(1e-6, ca... |
Stata file timestamp generation broken for version 117+
#### Description
When writing Stata files with version 117 or higher, the timestamp in the file header is malformed. The month name is missing from the timestamp string, causing issues when the file is read back or opened in Stata.
#### Steps/Code to Reproduce
... | diff --git a/pandas/io/stata.py b/pandas/io/stata.py
index 34d95fb..2afb4bf 100644
--- b/pandas/io/stata.py
+++ a/pandas/io/stata.py
@@ -3463,12 +3463,14 @@ class StataWriter117(StataWriter):
month_lookup = {i + 1: month for i, month in enumerate(months)}
ts = (
time_stamp.strftime("%d ")... |
### Issue: TypeError in For Loop Parsing
#### Description
After the recent changes, there seems to be an issue with parsing `for` loops in templates. The `For` node is not being constructed correctly, leading to a `TypeError` when attempting to render templates that include `for` loops. This error occurs across vario... | diff --git a/src/jinja2/parser.py b/src/jinja2/parser.py
index 817abec..0143201 100644
--- b/src/jinja2/parser.py
+++ a/src/jinja2/parser.py
@@ -235,29 +235,23 @@ class Parser:
def parse_for(self) -> nodes.For:
"""Parse a for loop."""
- lineno = next(self.stream).lineno
- target = self.par... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.