anchor stringlengths 10 14.3k | positive stringlengths 10 14.9k |
|---|---|
# [Bug]: `keep()` function breaks `autocurry` functionality
## Bug summary
In the current version, when using `keep()` with `autocurry`, it fails with a TypeError. The `keep()` function implementation is causing issues with higher-order functions that rely on iterating over function results.
## Code for reproduction... | diff --git a/funcy/seqs.py b/funcy/seqs.py
index 9a96252..f94faff 100644
--- b/funcy/seqs.py
+++ a/funcy/seqs.py
@@ -153,17 +153,10 @@ def keep(f, seq=EMPTY):
"""Maps seq with f and iterates truthy results.
Simply iterates truthy values in one argument version."""
if seq is EMPTY:
- # One argum... |
Loop context initialization broken for recursive loops
#### Description
When using recursive loops in Jinja2 templates, the loop context is not properly initialized, causing recursive loop functionality to fail completely.
#### Steps/Code to Reproduce
```python
from jinja2 import Template
# Simple recursive loop t... | diff --git a/src/jinja2/runtime.py b/src/jinja2/runtime.py
index 9dcc9d4..e4d05a3 100644
--- b/src/jinja2/runtime.py
+++ a/src/jinja2/runtime.py
@@ -418,11 +418,12 @@ class LoopContext:
loop is marked recursive.
:param depth0: Incremented when looping recursively.
"""
- self._itera... |
NameError in validate_qualify_columns function after removing variable declaration
#### Description
The `validate_qualify_columns` function in `sqlglot/optimizer/qualify_columns.py` is raising a `NameError` because the `all_unqualified_columns` variable is being referenced but not declared.
#### Steps/Code to Reprod... | diff --git a/sqlglot/optimizer/qualify_columns.py b/sqlglot/optimizer/qualify_columns.py
index 3ab987d..15456dd 100644
--- b/sqlglot/optimizer/qualify_columns.py
+++ a/sqlglot/optimizer/qualify_columns.py
@@ -114,6 +114,7 @@ def qualify_columns(
def validate_qualify_columns(expression: E) -> E:
"""Raise an `Opt... |
NamespacePrefixedTag parsing broken for namespace-prefixed XML tags
#### Description
When working with XML namespace-prefixed tags, the `NamespacePrefixedTag` class incorrectly parses the prefix and local part, causing various XML operations to fail.
#### Steps/Code to Reproduce
```python
from docx.oxml.ns import N... | diff --git a/src/docx/oxml/ns.py b/src/docx/oxml/ns.py
index 5bed1e6..16a9496 100644
--- b/src/docx/oxml/ns.py
+++ a/src/docx/oxml/ns.py
@@ -33,8 +33,8 @@ class NamespacePrefixedTag(str):
return super(NamespacePrefixedTag, cls).__new__(cls, nstag)
def __init__(self, nstag: str):
- self._local_par... |
CDD file parsing produces incorrect data field attributes
When loading CDD files, the data fields are getting their attributes mixed up. The name and id are swapped, minimum and maximum values are reversed, and factor/offset values are also swapped. Additionally, bit lengths are being reduced by 1 and byte order is be... | diff --git a/src/cantools/database/diagnostics/formats/cdd.py b/src/cantools/database/diagnostics/formats/cdd.py
index b25f9d5..43b02bc 100644
--- b/src/cantools/database/diagnostics/formats/cdd.py
+++ a/src/cantools/database/diagnostics/formats/cdd.py
@@ -26,17 +26,17 @@ class DataType:
unit,
... |
BUG: Series.value_counts with sort=False returns result sorted on values for Series with string dtype
### 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 ... | diff --git a/pandas/core/arrays/string_.py b/pandas/core/arrays/string_.py
index 7227ea7..2dfa165 100644
--- b/pandas/core/arrays/string_.py
+++ a/pandas/core/arrays/string_.py
@@ -990,7 +990,7 @@ class StringArray(BaseStringArray, NumpyExtensionArray): # type: ignore[misc]
def value_counts(self, dropna: bool = T... |
ParagraphFormat.left_indent returns incorrect values
#### Description
The `left_indent` property of `ParagraphFormat` is returning unexpected values. When a paragraph has no formatting properties, it should return `None`, but it's returning `0` instead. Additionally, when there are formatting properties present, the ... | diff --git a/src/docx/text/parfmt.py b/src/docx/text/parfmt.py
index ea37437..da1722b 100644
--- b/src/docx/text/parfmt.py
+++ a/src/docx/text/parfmt.py
@@ -91,8 +91,8 @@ class ParagraphFormat(ElementProxy):
"""
pPr = self._element.pPr
if pPr is None:
- return 0
- return pPr... |
# MIPROv2 optimizer not evaluating correctly with minibatch
## Description
I'm having an issue with the MIPROv2 optimizer when using minibatch mode. The optimizer seems to be evaluating incorrectly at intervals.
## Reproduction
Here's a simple example that demonstrates the issue:
```python
import dspy
from dspy.te... | diff --git a/dspy/teleprompt/mipro_optimizer_v2.py b/dspy/teleprompt/mipro_optimizer_v2.py
index 711b227..b45d033 100644
--- b/dspy/teleprompt/mipro_optimizer_v2.py
+++ a/dspy/teleprompt/mipro_optimizer_v2.py
@@ -607,7 +607,7 @@ class MIPROv2(Teleprompter):
)
# If minibatch, perform full eva... |
make_func returns wrong types for various inputs
When using `make_func` with different input types, the function returns incorrect types or behaviors:
```python
from funcy import make_func, make_pred
# String regex patterns return wrong results
func = make_func('\\d+')
print(func('ab42c')) # Expected: '42', Got: Tr... | diff --git a/funcy/funcmakers.py b/funcy/funcmakers.py
index e636ea7..ef2df85 100644
--- b/funcy/funcmakers.py
+++ a/funcy/funcmakers.py
@@ -11,17 +11,18 @@ def make_func(f, test=False):
if callable(f):
return f
elif f is None:
- return int if test else lambda x: x
+ # pass None to buil... |
#### Description
Type annotation order change in `__class_getitem__` breaks mypy type checking
The return type annotation for `BaseModel.__class_getitem__` was changed from `type[BaseModel] | _forward_ref.PydanticRecursiveRef` to `_forward_ref.PydanticRecursiveRef | type[BaseModel]`, which causes mypy to infer the wr... | diff --git a/pydantic/main.py b/pydantic/main.py
index 03cb511..a7f5b93 100644
--- b/pydantic/main.py
+++ a/pydantic/main.py
@@ -837,7 +837,7 @@ class BaseModel(metaclass=_model_construction.ModelMetaclass):
def __class_getitem__(
cls, typevar_values: type[Any] | tuple[type[Any], ...]
- ) -> _forward... |
Config attribute assignment broken after recent changes
#### Description
Setting configuration attributes on Config instances now raises `AttributeError: Invalid access!` when trying to assign values to valid configuration settings.
#### Steps/Code to Reproduce
```python
from gunicorn.config import Config
cfg = Co... | diff --git a/gunicorn/config.py b/gunicorn/config.py
index 402a26b..12352a7 100644
--- b/gunicorn/config.py
+++ a/gunicorn/config.py
@@ -67,7 +67,7 @@ class Config:
return self.settings[name].get()
def __setattr__(self, name, value):
- if name == "settings" or name not in self.settings:
+ ... |
IPvAnyNetwork and IPvAnyInterface validation order changed causing incorrect type detection
#### Description
When using `IPvAnyNetwork` or `IPvAnyInterface` types, the validation logic appears to have changed and now returns incorrect IP types for certain inputs. IPv4 addresses that should be detected as IPv4 are bei... | diff --git a/pydantic/networks.py b/pydantic/networks.py
index cae8238..1f58ffb 100644
--- b/pydantic/networks.py
+++ a/pydantic/networks.py
@@ -232,6 +232,7 @@ class _BaseUrl:
def __lt__(self, other: Any) -> bool:
return self.__class__ is other.__class__ and self._url < other._url
+
def __gt__(sel... |
# Docstring placement issue in Markdown compiler
I'm experiencing an issue with the Markdown compiler in Nikola. When building my site, I'm getting errors related to the Markdown compiler.
## Problem
The Markdown compiler seems to be failing to properly process Markdown files. After investigating, I found that there... | diff --git a/nikola/plugins/compile/markdown/__init__.py b/nikola/plugins/compile/markdown/__init__.py
index d6f137e..6829fc5 100644
--- b/nikola/plugins/compile/markdown/__init__.py
+++ a/nikola/plugins/compile/markdown/__init__.py
@@ -59,17 +59,18 @@ class ThreadLocalMarkdown(threading.local):
self.markdown ... |
DiskError exception handling removed from CLI causing unhandled exceptions
#### Description
When encountering a DiskError from dvc_data.hashfile.cache, the CLI no longer provides user-friendly error messages and instead shows raw stack traces.
#### Steps/Code to Reproduce
```python
from dvc_data.hashfile.cache impo... | diff --git a/dvc/cli/__init__.py b/dvc/cli/__init__.py
index ffff0eb..c72cd16 100644
--- b/dvc/cli/__init__.py
+++ a/dvc/cli/__init__.py
@@ -121,6 +121,23 @@ def _log_exceptions(exc: Exception) -> Optional[int]:
from dvc_data.hashfile.cache import DiskError
+ if isinstance(exc, DiskError):
+ from dvc... |
StaticFileHandler._get_content method returns empty generator
#### Description
The `StaticFileHandler._get_content` method appears to be broken and returns an empty generator instead of yielding file content chunks. This causes static file serving to fail with internal server errors.
#### Steps/Code to Reproduce
``... | diff --git a/tornado/web.py b/tornado/web.py
index 357c5f1..20725ee 100644
--- b/tornado/web.py
+++ a/tornado/web.py
@@ -2967,6 +2967,27 @@ class StaticFileHandler(RequestHandler):
.. versionadded:: 3.1
"""
+ with open(abspath, "rb") as file:
+ if start is not None:
+ ... |
NameError in pd.eval with float32 arrays and scalar operations
#### Description
When using `pd.eval` with float32 arrays and scalar operations, a `NameError` is raised due to an undefined variable `name`.
#### Steps/Code to Reproduce
```python
import pandas as pd
import numpy as np
# Create a float32 DataFrame
df ... | diff --git a/pandas/core/computation/expr.py b/pandas/core/computation/expr.py
index 14a393b..49bedb5 100644
--- b/pandas/core/computation/expr.py
+++ a/pandas/core/computation/expr.py
@@ -468,6 +468,8 @@ class BaseExprVisitor(ast.NodeVisitor):
and not right.is_scalar
and right.return_type == ... |
JSON schema generation fails for discriminated unions with aliased fields
#### Description
When generating JSON schemas for models with discriminated unions where the discriminator field uses an alias, the schema generation process encounters an undefined variable error.
#### Steps/Code to Reproduce
```python
from ... | diff --git a/pydantic/json_schema.py b/pydantic/json_schema.py
index ca031ea..df99b86 100644
--- b/pydantic/json_schema.py
+++ a/pydantic/json_schema.py
@@ -1262,6 +1262,7 @@ class GenerateJsonSchema:
alias = alias_path[0]
if not isinstance(alias, str):
continue #... |
SlidePlaceholders.__len__ returns incorrect count
#### Description
The `len()` function on `SlidePlaceholders` objects returns a count that is off by one. When calling `len(slide.placeholders)`, the returned value is one less than the actual number of placeholders present.
#### Steps/Code to Reproduce
```python
fro... | diff --git a/src/pptx/shapes/shapetree.py b/src/pptx/shapes/shapetree.py
index 29623f1..59b2635 100644
--- b/src/pptx/shapes/shapetree.py
+++ a/src/pptx/shapes/shapetree.py
@@ -797,7 +797,7 @@ class SlidePlaceholders(ParentedElementProxy):
def __len__(self) -> int:
"""Return count of placeholder shapes.... |
PSStackParser.pop() returns incorrect number of elements
When calling `pop(n)` on PSStackParser, the method returns `n+1` elements instead of the expected `n` elements due to an off-by-one error in the slicing operation.
#### Steps/Code to Reproduce
```python
from pdfminer.psparser import PSStackParser
# Create a p... | diff --git a/pdfminer/psparser.py b/pdfminer/psparser.py
index b486956..76d2355 100755
--- b/pdfminer/psparser.py
+++ a/pdfminer/psparser.py
@@ -449,9 +449,25 @@ class PSBaseParser:
self.oct += c
return i + 1
+ elif self.oct:
+ chrcode = int(self.oct, 8)
+ assert... |
BitStringPayloadDecoder missing inheritance from AbstractSimplePayloadDecoder
#### Description
The `BitStringPayloadDecoder` class is missing its inheritance from `AbstractSimplePayloadDecoder`, causing various decoding operations to fail.
#### Steps/Code to Reproduce
```python
from pyasn1.codec.ber import decoder
... | diff --git a/pyasn1/codec/ber/decoder.py b/pyasn1/codec/ber/decoder.py
index 7e69ca1..3418e33 100644
--- b/pyasn1/codec/ber/decoder.py
+++ a/pyasn1/codec/ber/decoder.py
@@ -158,7 +158,7 @@ class BooleanPayloadDecoder(IntegerPayloadDecoder):
self, asn1Spec, tagSet, value and 1 or 0, **options)
-class Bi... |
Post-load processors not being invoked during schema loading
#### Description
Post-load processors decorated with `@post_load` are not being executed when calling `schema.load()`. The processors are completely skipped, causing schemas that rely on post-load transformations to return raw dictionaries instead of proces... | diff --git a/src/marshmallow/schema.py b/src/marshmallow/schema.py
index e21768e..c685f14 100644
--- b/src/marshmallow/schema.py
+++ a/src/marshmallow/schema.py
@@ -893,13 +893,23 @@ class Schema(base.SchemaABC, metaclass=SchemaMeta):
errors = error_store.errors
# Run post processors
... |
# Chart data not updating correctly when modifying Excel data
I'm having an issue with updating chart data in PowerPoint presentations. When I try to update the Excel data for a chart, it's not working as expected.
## Problem Description
When trying to update the Excel data for a chart using the `update_from_xlsx_bl... | diff --git a/src/pptx/parts/chart.py b/src/pptx/parts/chart.py
index 7208071..477f2c2 100644
--- b/src/pptx/parts/chart.py
+++ a/src/pptx/parts/chart.py
@@ -69,10 +69,10 @@ class ChartWorkbook(object):
there isn't one.
"""
xlsx_part = self.xlsx_part
- if xlsx_part is not None:
+ ... |
# Parallel execution module breaks with recent changes
## Description
I've discovered an issue with the `Parallel` class in the `dspy.predict.parallel` module. After recent changes, the parallel execution functionality is completely broken. The module is unable to process examples correctly, resulting in AttributeErr... | diff --git a/dspy/predict/parallel.py b/dspy/predict/parallel.py
index 03a4235..78eb22e 100644
--- b/dspy/predict/parallel.py
+++ a/dspy/predict/parallel.py
@@ -30,60 +30,44 @@ class Parallel:
self.failed_examples = []
self.exceptions = []
- def forward(self, exec_pairs: List[Tuple[Any, Example]]... |
Parser fails to parse arithmetic expressions with multiplication and division operators
#### Description
When parsing SQL expressions containing multiplication (`*`) or division (`/`) operators, the parser returns incomplete expressions, missing the right-hand side of the operation.
#### Steps/Code to Reproduce
```... | diff --git a/sqlglot/parser.py b/sqlglot/parser.py
index 248a128..55a0467 100644
--- b/sqlglot/parser.py
+++ a/sqlglot/parser.py
@@ -4888,8 +4888,6 @@ class Parser(metaclass=_Parser):
parse_method = self._parse_exponent if self.EXPONENT else self._parse_unary
this = parse_method()
- return th... |
TokenList inheritance broken - TypeError on object initialization
#### Description
After recent changes, TokenList objects fail to initialize properly, causing widespread failures across the codebase. The issue appears to be related to inheritance changes in the TokenList class.
#### Steps/Code to Reproduce
```pyth... | diff --git a/sqlparse/sql.py b/sqlparse/sql.py
index 1037375..a1d99a4 100644
--- b/sqlparse/sql.py
+++ a/sqlparse/sql.py
@@ -148,7 +148,7 @@ class Token:
return False
-class TokenList():
+class TokenList(Token):
"""A group of tokens.
It has an additional instance attribute ``tokens`` which hold... |
Group.command decorator returns None instead of command object
When using the `@group.command` decorator, it now returns `None` instead of the command object. This breaks code that expects to get the command back from the decorator.
#### Steps/Code to Reproduce
```python
import click
@click.group()
def grp():
p... | diff --git a/src/click/core.py b/src/click/core.py
index abe9fa9..eeb3bba 100644
--- b/src/click/core.py
+++ a/src/click/core.py
@@ -1592,9 +1592,9 @@ class Group(Command):
kwargs["cls"] = self.command_class
def decorator(f: t.Callable[..., t.Any]) -> Command:
- cmd: Command = command... |
Multiplexer range generation broken for consecutive IDs
#### Description
When working with DBC files containing multiplexed signals, the multiplexer range generation logic produces incorrect results for consecutive multiplexer IDs. This affects signal tree generation and causes issues when loading certain DBC files w... | diff --git a/src/cantools/database/can/formats/dbc.py b/src/cantools/database/can/formats/dbc.py
index a5b6092..bc3b23e 100644
--- b/src/cantools/database/can/formats/dbc.py
+++ a/src/cantools/database/can/formats/dbc.py
@@ -995,16 +995,17 @@ def _create_mux_ranges(multiplexer_ids):
"""
ordered = sorted(mul... |
TabStops.__delitem__ raises NameError when deleting tab stops
#### Description
When trying to delete a tab stop using `del tab_stops[idx]`, a NameError is raised because the variable `tabs` is referenced before it's defined.
#### Steps/Code to Reproduce
```python
from docx import Document
from docx.shared import In... | diff --git a/src/docx/text/tabstops.py b/src/docx/text/tabstops.py
index 824085d..86ad201 100644
--- b/src/docx/text/tabstops.py
+++ a/src/docx/text/tabstops.py
@@ -18,15 +18,16 @@ class TabStops(ElementProxy):
self._pPr = element
def __delitem__(self, idx):
-
- if len(tabs) == 0:
- se... |
After updating the language mappings in `gtts/langs.py`, I encountered an issue where several languages are not being processed correctly, resulting in unexpected errors. Specifically, when attempting to use the Text-to-Speech (TTS) functionality for a variety of languages, the system returns a 429 error, indicating "T... | diff --git a/gtts/langs.py b/gtts/langs.py
index 5232ab1..2d351cd 100644
--- b/gtts/langs.py
+++ a/gtts/langs.py
@@ -44,9 +44,10 @@ _langs = {
"ne": "Nepali",
"nl": "Dutch",
"no": "Norwegian",
- "pa": "Punjabi",
+ "pa": "Punjabi (Gurmukhi)",
"pl": "Polish",
- "pt": "Portuguese",
+ "pt": ... |
#### Description
It seems there's an issue with the `compute_sec_ver` function in the `safety` module. When processing package versions, the function does not correctly handle the list of secure versions, leading to unexpected results in the remediation data. Specifically, the expected output for the `numpy` package d... | diff --git a/safety/models.py b/safety/models.py
index 20a8188..1899850 100644
--- b/safety/models.py
+++ a/safety/models.py
@@ -185,34 +185,17 @@ class Package(DictConverter):
Returns:
List[str]: The list of supported versions.
"""
- if not versions:
- return []
-
-... |
make_names_unique function returns None instead of database
#### Description
The `make_names_unique` function in the DBC format module is returning `None` instead of the modified database object, causing AttributeError when trying to access database attributes.
#### Steps/Code to Reproduce
```python
import cantools... | diff --git a/src/cantools/database/can/formats/dbc.py b/src/cantools/database/can/formats/dbc.py
index a5b6092..35976c7 100644
--- b/src/cantools/database/can/formats/dbc.py
+++ a/src/cantools/database/can/formats/dbc.py
@@ -1899,11 +1899,11 @@ def make_names_unique(database, shorten_long_names):
"""
+ make... |
UnboundLocalError when decoding multiplexed CAN messages
#### Description
When trying to decode multiplexed CAN messages, an `UnboundLocalError` occurs with the message "local variable 'mux' referenced before assignment". This affects all operations involving multiplexed signals in CAN database messages.
#### Steps/... | diff --git a/src/cantools/database/can/message.py b/src/cantools/database/can/message.py
index 942b2cc..5eac549 100644
--- b/src/cantools/database/can/message.py
+++ a/src/cantools/database/can/message.py
@@ -722,6 +722,7 @@ class Message:
assert_all_known)
... |
ParseResults boolean evaluation broken after unpickling
#### Description
When a ParseResults object is unpickled, its boolean evaluation returns incorrect results. The `__bool__` method seems to behave differently for unpickled objects compared to fresh ones.
#### Steps/Code to Reproduce
```python
import pickle
fro... | diff --git a/pyparsing/results.py b/pyparsing/results.py
index 2458478..b1e2de9 100644
--- b/pyparsing/results.py
+++ a/pyparsing/results.py
@@ -267,7 +267,7 @@ class ParseResults:
return len(self._toklist)
def __bool__(self) -> bool:
- return not (self._toklist and self._tokdict)
+ return... |
BER encoder uses wrong typeId and tagSet when asn1Spec is provided
#### Description
When encoding ASN.1 values with an explicit `asn1Spec` parameter, the BER encoder incorrectly uses the `asn1Spec`'s `typeId` and `tagSet` instead of the value's own attributes. This causes encoding to fail or produce incorrect results... | diff --git a/pyasn1/codec/ber/encoder.py b/pyasn1/codec/ber/encoder.py
index d16fb1f..288544a 100644
--- b/pyasn1/codec/ber/encoder.py
+++ a/pyasn1/codec/ber/encoder.py
@@ -824,9 +824,9 @@ class SingleItemEncoder(object):
def __call__(self, value, asn1Spec=None, **options):
try:
if asn1Spec i... |
# Alert groups not showing in console output
Grafanalib version: latest from main branch
## Description
When generating alert groups using the `print_alertgroup` function, the output is not being displayed in the console as expected. This affects the functionality of the `generate_alertgroup` command.
## Steps to r... | diff --git a/grafanalib/_gen.py b/grafanalib/_gen.py
index 4094edf..315bd94 100644
--- b/grafanalib/_gen.py
+++ a/grafanalib/_gen.py
@@ -86,7 +86,7 @@ AlertGroup generation
def print_alertgroup(dashboard):
- write_dashboard(dashboard, stream=sys.stderr)
+ write_dashboard(dashboard, stream=sys.stdout)
de... |
Binary expression generation produces incorrect SQL for nested operations
#### Description
When generating SQL for nested binary expressions, the output is malformed due to incorrect handling of the expression tree traversal.
#### Steps/Code to Reproduce
```python
import sqlglot
from sqlglot import parse_one
# Tes... | diff --git a/sqlglot/generator.py b/sqlglot/generator.py
index 34d2c0d..ba22479 100644
--- b/sqlglot/generator.py
+++ a/sqlglot/generator.py
@@ -3599,8 +3599,6 @@ class Generator(metaclass=_Generator):
node = stack.pop()
if type(node) is binary_type:
- sqls.append(self.sql(nod... |
Query bracket notation returns reversed field names
#### Description
When using bracket notation to access fields in TinyDB queries, the field names are being reversed. This causes queries to fail when trying to match documents with the expected field names.
#### Steps/Code to Reproduce
```python
from tinydb import... | diff --git a/tinydb/queries.py b/tinydb/queries.py
index 0ef6a69..bd2e905 100644
--- b/tinydb/queries.py
+++ a/tinydb/queries.py
@@ -194,7 +194,15 @@ class Query(QueryInstance):
return query
def __getitem__(self, item: str):
- return self.__getattr__(item[::-1])
+ # A different syntax for ... |
SFTP file seek operations with negative offsets produce incorrect positioning
When using SFTP file operations with negative offsets in `seek()` calls, the file position is calculated incorrectly. This affects operations like seeking backwards from the current position (`SEEK_CUR`) or from the end of file (`SEEK_END`).... | diff --git a/paramiko/sftp_file.py b/paramiko/sftp_file.py
index c74695e..9181c89 100644
--- b/paramiko/sftp_file.py
+++ a/paramiko/sftp_file.py
@@ -261,14 +261,15 @@ class SFTPFile(BufferedFile):
See `file.seek` for details.
"""
+ self.flush()
if whence == self.SEEK_SET:
... |
PackURI filename_index and relative_reference methods return incorrect values
#### Description
The `PackURI` class methods `filename_index` and `relative_reference` are returning incorrect values, causing issues with package URI handling and relative path computation.
#### Steps/Code to Reproduce
```python
from ppt... | diff --git a/src/pptx/opc/packuri.py b/src/pptx/opc/packuri.py
index 74ddd33..a3353aa 100644
--- b/src/pptx/opc/packuri.py
+++ a/src/pptx/opc/packuri.py
@@ -65,13 +65,13 @@ class PackURI(str):
"""
filename = self.filename
if not filename:
- return 0 # Should be None for consistenc... |
DatetimeIndex missing isocalendar method and _is_dates_only property
#### Description
After recent changes, DatetimeIndex no longer has the `isocalendar()` method and `_is_dates_only` property, causing AttributeError when these are accessed.
#### Steps/Code to Reproduce
```python
import pandas as pd
from datetime i... | diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py
index 9adbaad..a4fcc3c 100644
--- b/pandas/core/indexes/datetimes.py
+++ a/pandas/core/indexes/datetimes.py
@@ -294,6 +294,11 @@ class DatetimeIndex(DatetimeTimedeltaMixin):
arr = self._data.to_julian_date()
return Index.... |
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)
+ ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.