anchor stringlengths 10 14.3k | positive stringlengths 10 14.9k |
|---|---|
CSV export fails with NameError when using chunked writing
#### Description
When exporting DataFrames to CSV, the chunked writing functionality is broken due to an undefined variable reference. The `chunks` variable is used in a loop before it's defined, causing a NameError.
#### Steps/Code to Reproduce
```python
i... | diff --git a/pandas/io/excel/_openpyxl.py b/pandas/io/excel/_openpyxl.py
index 3055c68..7baf7df 100644
--- b/pandas/io/excel/_openpyxl.py
+++ a/pandas/io/excel/_openpyxl.py
@@ -453,6 +453,31 @@ class OpenpyxlWriter(ExcelWriter):
_style_cache: dict[str, dict[str, Serialisable]] = {}
+ if sheet_name i... |
Range validator error messages swapped min/max values
When using the Range validator, the error messages are displaying incorrect min/max values. The min and max values appear to be swapped in the error message formatting.
#### Steps/Code to Reproduce
```python
from marshmallow import validate, ValidationError
# Te... | diff --git a/src/marshmallow/validate.py b/src/marshmallow/validate.py
index e4536d8..eeffcb9 100644
--- b/src/marshmallow/validate.py
+++ a/src/marshmallow/validate.py
@@ -339,7 +339,7 @@ class Range(Validator):
return f"min={self.min!r}, max={self.max!r}, min_inclusive={self.min_inclusive!r}, max_inclusive={... |
RSS feeds are empty - no items are being generated
I found a bug in the RSS feed generation. When trying to access any RSS feed on my site, the feed is empty - it contains no items.
Here's a simple reproduction:
```python
from nikola import Nikola
from nikola.plugins.command.init import CommandInit
# Create a new s... | diff --git a/nikola/nikola.py b/nikola/nikola.py
index 6f80377..480179c 100644
--- b/nikola/nikola.py
+++ a/nikola/nikola.py
@@ -1802,10 +1802,59 @@ class Nikola(object):
feedRelUri='/' + feed_url[len(self.config['BASE_URL']):],
feedFormat="rss")
+ for post in timeline[:feed_l... |
NGram constructor missing after refactoring
#### Description
The NGram class no longer accepts initialization parameters. When trying to create an NGram instance with a specific n-gram size, it raises a TypeError.
#### Steps/Code to Reproduce
```python
from strsimpy.ngram import NGram
# This should work but raises... | diff --git a/strsimpy/ngram.py b/strsimpy/ngram.py
index 27d4ae1..068509e 100644
--- b/strsimpy/ngram.py
+++ a/strsimpy/ngram.py
@@ -23,6 +23,9 @@ from .string_distance import NormalizedStringDistance
class NGram(NormalizedStringDistance):
+ def __init__(self, n=2):
+ self.n = n
+
def distance(self,... |
UnboundLocalError in mmseg segmentation when using pypinyin
#### Description
Getting `UnboundLocalError: local variable 'remain' referenced before assignment` when trying to use pypinyin for Chinese text segmentation. This seems to affect the core segmentation functionality.
#### Steps/Code to Reproduce
```python
f... | diff --git a/pypinyin/seg/mmseg.py b/pypinyin/seg/mmseg.py
index f35eb1c..a801c18 100644
--- b/pypinyin/seg/mmseg.py
+++ a/pypinyin/seg/mmseg.py
@@ -21,7 +21,9 @@ class Seg(object):
:param text: 待分词的文本
:yield: 单个词语
"""
+ remain = text
while remain:
+ matched = ''
... |
PSBaseParser token order reversed after parsing
#### Description
The PSBaseParser is inserting tokens in reverse order, causing parsed tokens to appear in the wrong sequence. This affects PDF parsing operations that depend on the correct token order.
#### Steps/Code to Reproduce
```python
from pdfminer.psparser imp... | diff --git a/pdfminer/psparser.py b/pdfminer/psparser.py
index b486956..c21807d 100755
--- b/pdfminer/psparser.py
+++ a/pdfminer/psparser.py
@@ -315,7 +315,7 @@ class PSBaseParser:
return j + 1
def _add_token(self, obj: PSBaseParserToken) -> None:
- self._tokens.insert(0, (self._curtokenpos -... |
String padding methods return undefined function instead of padded strings
#### Description
When using string padding methods like `str.center()`, `str.ljust()`, `str.rjust()`, and `str.pad()` on pandas Series, the methods return an undefined function `f` instead of the expected padded strings.
#### Steps/Code to Re... | diff --git a/pandas/core/strings/object_array.py b/pandas/core/strings/object_array.py
index 0adb7b5..5ed2d17 100644
--- b/pandas/core/strings/object_array.py
+++ a/pandas/core/strings/object_array.py
@@ -123,7 +123,6 @@ class ObjectStringArrayMixin(BaseStringArrayMethods):
side: Literal["left", "right", "both... |
ChunkedReader accepts empty chunk size causing parsing errors
When processing chunked HTTP requests, the ChunkedReader now incorrectly accepts empty chunk sizes, which should be invalid according to HTTP specifications.
#### Steps/Code to Reproduce
```python
from gunicorn.http.body import ChunkedReader
from gunicorn... | diff --git a/gunicorn/http/body.py b/gunicorn/http/body.py
index d7ee29e..dbbe69f 100644
--- b/gunicorn/http/body.py
+++ a/gunicorn/http/body.py
@@ -89,8 +89,12 @@ class ChunkedReader:
# RFC9112 7.1.1: BWS before chunk-ext - but ONLY then
chunk_size, *chunk_ext = line.split(b";", 1)
+ if chun... |
Lexer detection broken for configuration files
#### Description
The lexer detection for configuration files (INI, Desktop, Systemd) is not working correctly. Files that should be detected as specific configuration formats are being misidentified as other lexers.
#### Steps/Code to Reproduce
```python
from pygments.... | diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py
index 365a88a..8e582eb 100644
--- b/pygments/lexers/configs.py
+++ a/pygments/lexers/configs.py
@@ -72,11 +72,11 @@ class IniLexer(RegexLexer):
def analyse_text(text):
npos = text.find('\n')
- if npos <= 3:
+ if npos < 3:... |
OrderedSet discard method corrupts internal structure
#### Description
The `discard` method in `OrderedSet` appears to corrupt the internal linked list structure when removing elements. After discarding an element, subsequent operations on the set produce incorrect results.
#### Steps/Code to Reproduce
```python
fr... | diff --git a/src/marshmallow/orderedset.py b/src/marshmallow/orderedset.py
index 7ce0723..e11cc0f 100644
--- b/src/marshmallow/orderedset.py
+++ a/src/marshmallow/orderedset.py
@@ -44,10 +44,10 @@ class OrderedSet(MutableSet):
curr[2] = end[1] = self.map[key] = [key, curr, end]
def discard(self, key... |
CompletionItem constructor swaps value and help parameters
#### Description
The `CompletionItem` class constructor appears to have swapped the `value` and `help` parameters internally. When creating completion items, the value gets assigned to the help field and vice versa.
#### Steps/Code to Reproduce
```python
fr... | diff --git a/src/click/shell_completion.py b/src/click/shell_completion.py
index c8655b1..da735ab 100644
--- b/src/click/shell_completion.py
+++ a/src/click/shell_completion.py
@@ -82,10 +82,10 @@ class CompletionItem:
help: str | None = None,
**kwargs: t.Any,
) -> None:
- self.value: t.An... |
Decorator line number detection broken for functions without decorators
When processing function definitions, the transformer incorrectly assigns line numbers for functions that don't have decorators. This causes an IndexError when trying to access decorator_list elements.
#### Steps/Code to Reproduce
```python
from... | diff --git a/src/typeguard/_transformer.py b/src/typeguard/_transformer.py
index 25696a5..0ccd313 100644
--- b/src/typeguard/_transformer.py
+++ a/src/typeguard/_transformer.py
@@ -674,9 +674,9 @@ class TypeguardTransformer(NodeTransformer):
if self._target_path is None or self._memo.path == self._target_p... |
# Locale initialization broken when using gettext translations
## Description
I'm encountering errors when trying to use translations in Tornado. The application crashes when trying to load locale data.
Python 3.8; Tornado 6.1
Traceback (most recent call last):
File "/app/myapp.py", line 15, in <module>
local... | diff --git a/tornado/locale.py b/tornado/locale.py
index abd8668..d1cf791 100644
--- b/tornado/locale.py
+++ a/tornado/locale.py
@@ -260,11 +260,12 @@ class Locale:
if translations is None:
locale = CSVLocale(code, {}) # type: Locale
elif _use_gettext:
+ locale... |
CLI proxy arguments not parsed correctly after recent changes
#### Description
The CLI is not properly parsing proxy-related arguments like `--proxy-port`, `--proxy-host`, and `--key` anymore. When using these options, they seem to be ignored and the proxy configuration doesn't work as expected.
#### Steps/Code to R... | diff --git a/safety/cli_util.py b/safety/cli_util.py
index 3579dbc..a7e9436 100644
--- b/safety/cli_util.py
+++ a/safety/cli_util.py
@@ -700,9 +700,16 @@ class SafetyCLILegacyGroup(UtilityCommandMixin, click.Group):
for i, arg in enumerate(args):
if arg in ['--proxy-protocol', '-pr'] and i + 1 < l... |
XQuery lexer produces incorrect token positions causing roundtrip failures
#### Description
The XQuery lexer is generating tokens with incorrect positions, causing the lexer roundtrip to fail. When tokenizing XQuery code, the reconstructed text from tokens doesn't match the original input.
#### Steps/Code to Reprodu... | diff --git a/pygments/lexers/webmisc.py b/pygments/lexers/webmisc.py
index 815c7a3..959edd1 100644
--- b/pygments/lexers/webmisc.py
+++ a/pygments/lexers/webmisc.py
@@ -290,10 +290,10 @@ class XQueryLexer(ExtendedRegexLexer):
ctx.pos = match.end()
def pushstate_operator_root_callback(lexer, match, ctx):... |
String truncation with ellipsis not working in DataFrame display
#### Description
When displaying DataFrames with long strings that exceed the `max_colwidth` setting, the truncation with "..." ellipsis is not being applied. Long strings are displayed in full instead of being truncated.
#### Steps/Code to Reproduce
... | diff --git a/pandas/io/formats/format.py b/pandas/io/formats/format.py
index b7fbc4e..39b8dbc 100644
--- b/pandas/io/formats/format.py
+++ a/pandas/io/formats/format.py
@@ -1737,13 +1737,14 @@ def _make_fixed_width(
def just(x: str) -> str:
if conf_max is not None:
if (conf_max > 3) & (adjust... |
### Table of Contents Rendering Issue
It seems there's a problem with the rendering of the table of contents (ToC) after the recent changes. The ToC is not being generated correctly, especially when dealing with nested lists or complex structures.
#### Steps to Reproduce:
1. Create a markdown document with multiple ... | diff --git a/src/mistune/toc.py b/src/mistune/toc.py
index be4b8b3..a04ed24 100644
--- b/src/mistune/toc.py
+++ a/src/mistune/toc.py
@@ -66,7 +66,7 @@ def normalize_toc_item(md: "Markdown", token: Dict[str, Any]) -> Tuple[int, str,
return attrs['level'], attrs['id'], text
-def render_toc_ul(toc: Iterable[Tuple... |
@view decorator returns None instead of template result
#### Description
The `@view` decorator is not working correctly and returns `None` instead of rendering the template with the provided variables.
#### Steps/Code to Reproduce
```python
from bottle import view
@view('Hello {{name}}!')
def greet():
return {... | diff --git a/bottle.py b/bottle.py
index 286b5bc..927e97b 100755
--- b/bottle.py
+++ a/bottle.py
@@ -4504,6 +4504,7 @@ def view(tpl_name, **defaults):
@functools.wraps(func)
def wrapper(*args, **kwargs):
+ result = func(*args, **kwargs)
if isinstance(result, (dict, DictMixin)... |
Container.select method missing after refactor
#### Description
After a recent refactor, the `select` method has been removed from the `Container` class, causing `AttributeError` when trying to access nested data using dot notation.
#### Steps/Code to Reproduce
```python
from dvc.parsing.context import Context
# C... | diff --git a/dvc/parsing/context.py b/dvc/parsing/context.py
index af8d1b3..bfa6cc8 100644
--- b/dvc/parsing/context.py
+++ a/dvc/parsing/context.py
@@ -182,6 +182,9 @@ class Container(Node, ABC):
msg = f"Unsupported value of type '{type(value).__name__}' in '{meta}'"
raise TypeError(msg)
+ def _... |
Signal offset property returns incorrect value
#### Description
The signal offset property is returning an incorrect value that appears to be multiplied by 1.5. This affects signal conversion calculations and causes incorrect values to be returned when accessing the offset property.
#### Steps/Code to Reproduce
```... | diff --git a/src/cantools/database/can/signal.py b/src/cantools/database/can/signal.py
index c518727..b783031 100644
--- b/src/cantools/database/can/signal.py
+++ a/src/cantools/database/can/signal.py
@@ -196,7 +196,7 @@ class Signal:
@property
def offset(self) -> Union[int, float]:
"""The offset of ... |
Font decoding returns reversed byte order
#### Description
When processing PDF fonts, the byte decoding is returning characters in reversed order, causing text extraction to produce garbled output.
#### Steps/Code to Reproduce
```python
from pdfminer.high_level import extract_text
# Extract text from a simple PDF
... | diff --git a/pdfminer/pdffont.py b/pdfminer/pdffont.py
index e1df40c..54b202a 100644
--- b/pdfminer/pdffont.py
+++ a/pdfminer/pdffont.py
@@ -894,13 +894,13 @@ class PDFFont:
return "<PDFFont>"
def is_vertical(self) -> bool:
- return True
+ return False
def is_multibyte(self) -> bool... |
**Hook Script Execution Fails with Incorrect Error Handling**
**Description**
When executing hook scripts, the error handling mechanism does not properly capture and report failures. This results in misleading error messages and unexpected behavior when a hook script fails to execute correctly.
**To Reproduce**
1. Cr... | diff --git a/cookiecutter/hooks.py b/cookiecutter/hooks.py
index 7546a23..f9b4a72 100644
--- b/cookiecutter/hooks.py
+++ a/cookiecutter/hooks.py
@@ -77,43 +77,33 @@ def find_hook(hook_name: str, hooks_dir: str = 'hooks') -> list[str] | None:
return scripts
-def run_script(script_path: str, cwd: (Path | str)='.... |
# Theme property in ColorTable always returns a new Theme instance
When using the `theme` property in `ColorTable`, it always returns a new `Theme` instance instead of the actual theme that was set.
## How to reproduce
```python
from prettytable import ColorTable
from prettytable.colortable import Theme
# Create a ... | diff --git a/src/prettytable/colortable.py b/src/prettytable/colortable.py
index 52e1fa2..2bacc69 100644
--- b/src/prettytable/colortable.py
+++ a/src/prettytable/colortable.py
@@ -104,9 +104,7 @@ class ColorTable(PrettyTable):
@property
def theme(self) -> Theme:
- if self._theme is not None:
- ... |
JSON schema generation fails silently for invalid core schemas
#### Description
When generating JSON schemas, invalid core schema references are now silently ignored instead of raising appropriate errors. This causes the schema generation process to continue without properly handling schemas that cannot be converted ... | diff --git a/pydantic/json_schema.py b/pydantic/json_schema.py
index ca031ea..b4947fc 100644
--- b/pydantic/json_schema.py
+++ a/pydantic/json_schema.py
@@ -2244,9 +2244,12 @@ class GenerateJsonSchema:
return # prevent recursion on a definition that was already visited
try... |
Excel integer conversion broken and merged cells not displaying correctly
Description
I've found two issues with the latest pandas version when working with Excel files:
1. Integer values in Excel files are not being converted correctly. When reading Excel files that contain integer values, they are being kept as fl... | diff --git a/pandas/io/excel/_xlrd.py b/pandas/io/excel/_xlrd.py
index 5d39a84..ae10e71 100644
--- b/pandas/io/excel/_xlrd.py
+++ a/pandas/io/excel/_xlrd.py
@@ -122,9 +122,12 @@ class XlrdReader(BaseExcelReader["Book"]):
# GH5394 - Excel 'numbers' are always floats
# it's a minimal per... |
Character normalization broken for multiple language scripts
#### Description
The character normalization in NGram is producing incorrect results for various language scripts including Latin, Romanian, Vietnamese, CJK, and others. Characters that should be normalized to specific values are being mapped incorrectly or... | diff --git a/langdetect/utils/ngram.py b/langdetect/utils/ngram.py
index ee82e38..4bac93f 100644
--- b/langdetect/utils/ngram.py
+++ a/langdetect/utils/ngram.py
@@ -65,34 +65,35 @@ class NGram(object):
def normalize(cls, ch):
block = unicode_block(ch)
if block == UNICODE_BASIC_LATIN:
- ... |
Perl6 lexer crashes with NameError on bracket constructs
#### Description
The Perl6 lexer throws a `NameError: name 'groups' is not defined` when processing certain bracket constructs in Perl6 code. This affects syntax highlighting for valid Perl6 files.
#### Steps/Code to Reproduce
```python
from pygments import h... | diff --git a/pygments/lexers/perl.py b/pygments/lexers/perl.py
index 3ec1944..7a58a58 100644
--- b/pygments/lexers/perl.py
+++ a/pygments/lexers/perl.py
@@ -503,6 +503,7 @@ class Perl6Lexer(ExtendedRegexLexer):
def brackets_callback(token_class):
def callback(lexer, match, context):
+ groups ... |
Enum inference fails with invalid attribute names containing spaces
#### Description
When creating an Enum with attribute names that contain spaces, the inference process crashes instead of gracefully handling the invalid names.
#### Steps/Code to Reproduce
```python
from enum import Enum
# This should not crash t... | diff --git a/astroid/brain/brain_namedtuple_enum.py b/astroid/brain/brain_namedtuple_enum.py
index 67d706d..1ddc94a 100644
--- b/astroid/brain/brain_namedtuple_enum.py
+++ a/astroid/brain/brain_namedtuple_enum.py
@@ -107,7 +107,11 @@ def infer_func_form(
# Enums supports either iterator of (name, value... |
# Incorrect order of conditions causes organization name display error
I'm encountering an issue with the organization name display in the Safety CLI. When running a scan command, the organization name is not being displayed correctly.
## Steps to reproduce
1. Set up a Safety CLI environment with an organization
2. ... | diff --git a/safety/scan/decorators.py b/safety/scan/decorators.py
index 72d7e4e..d610d6f 100644
--- b/safety/scan/decorators.py
+++ a/safety/scan/decorators.py
@@ -130,7 +130,7 @@ def scan_project_command_init(func):
console.print()
- if ctx.obj.auth.org.name and ctx.obj.auth.org:
+ if ctx.o... |
SAS7BDAT reader crashes with NameError when reading files
#### Description
When trying to read SAS7BDAT files using pandas, the reader crashes with a `NameError: name 'p' is not defined` error. This affects all SAS file reading operations.
#### Steps/Code to Reproduce
```python
import pandas as pd
# Try to read an... | diff --git a/pandas/io/sas/sas7bdat.py b/pandas/io/sas/sas7bdat.py
index 792af5f..3a739d9 100644
--- b/pandas/io/sas/sas7bdat.py
+++ a/pandas/io/sas/sas7bdat.py
@@ -640,7 +640,7 @@ class SAS7BDATReader(SASReader):
def read(self, nrows: int | None = None) -> DataFrame:
if (nrows is None) and (self.chunks... |
ResponseTypes.from_body() raises UnboundLocalError for lowercase_chunk
#### Description
When using `ResponseTypes.from_body()` to detect response types from body content, an `UnboundLocalError` is raised because `lowercase_chunk` is referenced before being defined.
#### Steps/Code to Reproduce
```python
from scrapy... | diff --git a/scrapy/responsetypes.py b/scrapy/responsetypes.py
index 3f6f030..aea8750 100644
--- b/scrapy/responsetypes.py
+++ a/scrapy/responsetypes.py
@@ -104,22 +104,23 @@ class ResponseTypes:
return Response
def from_body(self, body: bytes) -> type[Response]:
- if b"<html>" in lowercase_chunk... |
BER encoder fails to encode values after removing error handling
#### Description
The BER encoder is failing to encode ASN.1 values. When trying to encode various ASN.1 types like OctetString, BitString, Choice, etc., the encoding process doesn't work properly and produces incorrect results.
#### Steps/Code to Repro... | diff --git a/pyasn1/codec/ber/encoder.py b/pyasn1/codec/ber/encoder.py
index d16fb1f..8dd48a9 100644
--- b/pyasn1/codec/ber/encoder.py
+++ a/pyasn1/codec/ber/encoder.py
@@ -97,6 +97,14 @@ class AbstractItemEncoder(object):
# base tag?
if not idx:
+ try:
+ su... |
# DVC Output class initialization fails with missing variables
I'm trying to use DVC and encountering issues with the Output class. When trying to work with outputs, I'm getting various errors related to missing variables and attributes.
## Description
After a recent code change, the Output class initialization is b... | diff --git a/dvc/output.py b/dvc/output.py
index 48acf49..5d5fc00 100644
--- b/dvc/output.py
+++ a/dvc/output.py
@@ -330,6 +330,7 @@ class Output:
desc=desc, type=type, labels=labels or [], meta=meta or {}
)
self.repo = stage.repo if not repo and stage else repo
+ meta_d = merge_fi... |
RFC 822 date parsing returns incorrect timestamps
#### Description
When parsing RFC 822 formatted dates, the parser is returning incorrect timestamps. The issue appears to affect various date formats including those with timezones and different date orderings.
#### Steps/Code to Reproduce
```python
import feedparse... | diff --git a/feedparser/datetimes/rfc822.py b/feedparser/datetimes/rfc822.py
index 16f6d8d..4136ec5 100644
--- b/feedparser/datetimes/rfc822.py
+++ a/feedparser/datetimes/rfc822.py
@@ -71,23 +71,45 @@ months = {
def _parse_date_rfc822(date):
+ """Parse RFC 822 dates and times
+ http://tools.ietf.org/html/rfc... |
sort_signals_by_start_bit_reversed drops last signal instead of reversing order
#### Description
When using `sort_signals_by_start_bit_reversed`, the function incorrectly drops the last signal from the list instead of returning the signals in reverse order by start bit.
#### Steps/Code to Reproduce
```python
import... | diff --git a/src/cantools/database/utils.py b/src/cantools/database/utils.py
index cd33b81..a51f5bd 100644
--- b/src/cantools/database/utils.py
+++ a/src/cantools/database/utils.py
@@ -448,7 +448,7 @@ def sort_signals_by_start_bit(signals: list["Signal"]) -> list["Signal"]:
def sort_signals_by_start_bit_reversed(s... |
Progress bar output not appearing after Stop() is called
#### Description
After calling Stop() on a progress bar, content that should be printed to the output buffer is not appearing. This affects the ability to display final messages or results after progress tracking is complete.
#### Steps/Code to Reproduce
```g... | diff --git a/progress.go b/progress.go
index 300b662..855865c 100644
--- b/progress.go
+++ a/progress.go
@@ -41,18 +41,19 @@ type Progress struct {
// New returns a new progress bar with defaults
func New() *Progress {
- p := &Progress{
+ lw := uilive.New()
+ lw.Out = Out
+
+ return &Progress{
+ Width: W... |
Hello,
I've encountered an issue with the rendering of HTML documents using the `dominate` library after a recent change. It seems that the `container` class is not rendering its children correctly, which is causing unexpected output in several scenarios.
Here's a simple example to reproduce the issue:
```python
fro... | diff --git a/dominate/util.py b/dominate/util.py
index 1d730b3..1611bf0 100644
--- b/dominate/util.py
+++ a/dominate/util.py
@@ -125,15 +125,14 @@ class container(dom_tag):
Contains multiple elements, but does not add a level
'''
is_inline = True
-def _render(self, sb, indent_level, indent_str, pretty, xhtml):... |
Decorator functions not working properly after recent changes
#### Description
The `@deprecate_kwarg` decorator appears to be broken. Functions decorated with this decorator are not executing their deprecation logic and are returning immediately without processing arguments.
#### Steps/Code to Reproduce
```python
f... | diff --git a/pandas/util/_decorators.py b/pandas/util/_decorators.py
index a1a0d51..164b501 100644
--- b/pandas/util/_decorators.py
+++ a/pandas/util/_decorators.py
@@ -171,7 +171,7 @@ def deprecate_kwarg(
def _deprecate_kwarg(func: F) -> F:
@wraps(func)
def wrapper(*args, **kwargs) -> Callable[.... |
Rolling window operations return UnboundLocalError for empty arrays
#### Description
When applying rolling window operations on empty arrays or Series, an `UnboundLocalError` is raised because the `result` variable is referenced before assignment in the calculation function.
#### Steps/Code to Reproduce
```python
i... | diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py
index 69fce8c..74de27a 100644
--- b/pandas/core/window/rolling.py
+++ a/pandas/core/window/rolling.py
@@ -585,15 +585,12 @@ class BaseWindow(SelectionMixin):
)
def homogeneous_func(values: np.ndarray):
+ # calculat... |
Parser fails with NameError when parsing queries with LIMIT and OFFSET
When parsing SQL queries that contain both LIMIT and OFFSET clauses, the parser throws a `NameError: name 'expression' is not defined` error. This appears to affect multiple SQL dialects and breaks basic query parsing functionality.
#### Steps to ... | diff --git a/sqlglot/parser.py b/sqlglot/parser.py
index 248a128..97af0e3 100644
--- b/sqlglot/parser.py
+++ a/sqlglot/parser.py
@@ -3365,10 +3365,13 @@ class Parser(metaclass=_Parser):
while True:
if self._match_set(self.QUERY_MODIFIER_PARSERS, advance=False):
+ parse... |
Unicode escape sequences not properly encoded for certain characters
#### Description
When encoding strings that contain certain Unicode characters, the encoder is not properly generating the expected `\uXXXX` escape sequences. Instead, it's outputting the raw Unicode characters directly.
#### Steps/Code to Reproduc... | diff --git a/encode.go b/encode.go
index 1245cdd..bb29585 100644
--- b/encode.go
+++ a/encode.go
@@ -99,26 +99,14 @@ var meta = map[byte][]byte{
}
func (e *hjsonEncoder) quoteReplace(text string) string {
- b := make([]byte, 0, len(text))
- for i := 0; i < len(text); {
- r, width := utf8.DecodeRuneInString(text[i:... |
# DSS key functionality broken in multiple ways
I've discovered several issues with the DSS key implementation that break key functionality:
1. The `can_sign()` method is returning the opposite of what it should - it's returning `True` when `self.x is None` instead of when `self.x is not None`. This means private key... | diff --git a/paramiko/dsskey.py b/paramiko/dsskey.py
index 5215d28..a1c23a0 100644
--- b/paramiko/dsskey.py
+++ a/paramiko/dsskey.py
@@ -106,7 +106,7 @@ class DSSKey(PKey):
return self.size
def can_sign(self):
- return self.x is None
+ return self.x is not None
def sign_ssh_data(sel... |
# TOML parsing issues with array tables and time parsing
## Bug report
**Bug summary**
There are two issues with the TOML parser:
1. When using the `[[table]]` syntax (array of tables), the parser fails to properly handle certain cases, resulting in a `KeyError` or `TOMLDecodeError` when parsing valid TOML files.
2... | diff --git a/src/tomli/_parser.py b/src/tomli/_parser.py
index 16c76cd..cdee18a 100644
--- b/src/tomli/_parser.py
+++ a/src/tomli/_parser.py
@@ -368,24 +368,28 @@ def create_dict_rule(src: str, pos: Pos, out: Output) -> tuple[Pos, Key]:
def create_list_rule(src: str, pos: Pos, out: Output) -> tuple[Pos, Key]:
- ... |
### Issue: Incorrect Charset and Language Detection
#### Describe the Bug
After the recent changes, the charset and language detection seems to be malfunctioning. The detection process is not correctly identifying the expected charset and language for various text samples. This issue is particularly noticeable with n... | diff --git a/charset_normalizer/cd.py b/charset_normalizer/cd.py
index 71a3ed5..97e36e2 100644
--- b/charset_normalizer/cd.py
+++ a/charset_normalizer/cd.py
@@ -255,39 +255,38 @@ def alpha_unicode_split(decoded_sequence: str) -> list[str]:
Ex. a text containing English/Latin with a bit a Hebrew will return two ite... |
### ImportError: cannot import name 'InvalidRequirementError'
**Description:**
After applying the recent changes, an `ImportError` is raised when trying to import `InvalidRequirementError` from `pipdeptree._models.package`. This error occurs during the import process in the `conftest.py` file, which is crucial for se... | diff --git a/src/pipdeptree/_discovery.py b/src/pipdeptree/_discovery.py
index ba23498..dc3779b 100644
--- b/src/pipdeptree/_discovery.py
+++ a/src/pipdeptree/_discovery.py
@@ -130,4 +130,4 @@ def render_duplicated_dist_metadata_text(
__all__ = [
"get_installed_distributions",
-]
+]
\ No newline at end of file
... |
# Inconsistent behavior in parse_value function for Literal types
While working with DSPy, I noticed an issue with the `parse_value` function in `dspy/adapters/utils.py` when handling Literal types. The function doesn't correctly match string values to their corresponding Literal values in some cases.
## Description
... | diff --git a/dspy/adapters/utils.py b/dspy/adapters/utils.py
index 21540bd..617e6e5 100644
--- b/dspy/adapters/utils.py
+++ a/dspy/adapters/utils.py
@@ -132,139 +132,48 @@ def find_enum_member(enum, identifier):
def parse_value(value, annotation):
- """
- Parses a value according to the specified type annota... |
HOCRConverter produces incorrect output with reversed page elements and wrong bounding boxes
#### Description
The HOCR converter is generating malformed output with several issues affecting the structure and positioning of text elements. The generated HOCR markup has incorrect element ordering and bounding box calcul... | diff --git a/pdfminer/converter.py b/pdfminer/converter.py
index 7563c7a..c422b1b 100644
--- b/pdfminer/converter.py
+++ a/pdfminer/converter.py
@@ -977,28 +977,27 @@ class HOCRConverter(PDFConverter[AnyIO]):
def receive_layout(self, ltpage: LTPage) -> None:
def render(item: LTItem) -> None:
... |
ARXML loader fails with "Cannot retrieve a child element of a non-existing node!" for AUTOSAR 4.x files
#### Description
When loading AUTOSAR 4.x ARXML files, the system loader throws an `UnsupportedDatabaseFormatError` with the message "Cannot retrieve a child element of a non-existing node!". This appears to affect... | diff --git a/src/cantools/database/can/formats/arxml/system_loader.py b/src/cantools/database/can/formats/arxml/system_loader.py
index f7aa786..c9adf76 100644
--- b/src/cantools/database/can/formats/arxml/system_loader.py
+++ a/src/cantools/database/can/formats/arxml/system_loader.py
@@ -1597,6 +1597,23 @@ class System... |
#### Description
Function argument types are not being collected when generating stubs from traced types.
#### Steps/Code to Reproduce
```python
from monkeytype.stubs import shrink_traced_types
from monkeytype.tracing import CallTrace
from collections import defaultdict
# Create some sample traces with argument typ... | diff --git a/monkeytype/stubs.py b/monkeytype/stubs.py
index 9c1d3eb..07828ce 100644
--- b/monkeytype/stubs.py
+++ a/monkeytype/stubs.py
@@ -228,6 +228,8 @@ def shrink_traced_types(
return_types: Set[type] = set()
yield_types: Set[type] = set()
for t in traces:
+ for arg, typ in t.arg_types.items(... |
# Checkout fails to delete files without confirmation when `force=True`
When using the `checkout` function with `force=True`, it still prompts for confirmation before deleting files that don't exist in the cache. This behavior is inconsistent with the expected behavior of the `force` parameter.
A minimal example to r... | diff --git a/dvc/repo/checkout.py b/dvc/repo/checkout.py
index 176749a..0d186d7 100644
--- b/dvc/repo/checkout.py
+++ a/dvc/repo/checkout.py
@@ -1,13 +1,23 @@
-import logging
import os
-from typing import Dict, List
-
-from dvc.exceptions import CheckoutError, CheckoutErrorSuggestGit, NoOutputOrStageError
+from typing... |
TabStops initialization broken causing AttributeError on all operations
#### Description
TabStops class is completely broken after recent changes. Any attempt to use TabStops functionality results in AttributeError because the initialization is corrupted.
#### Steps/Code to Reproduce
```python
from docx import Docu... | diff --git a/src/docx/text/parfmt.py b/src/docx/text/parfmt.py
index ea37437..4c7a607 100644
--- b/src/docx/text/parfmt.py
+++ a/src/docx/text/parfmt.py
@@ -113,8 +113,8 @@ class ParagraphFormat(ElementProxy):
"""
pPr = self._element.pPr
if pPr is None:
- return 0
- return s... |
Incorrect empty FQDN when no subdomain and domain
When the extract result's subdomain and domain are both empty, it will return an incorrect empty FQDN.
```python
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import... | diff --git a/tldextract/cli.py b/tldextract/cli.py
index e9aa6ce..23b4f01 100644
--- b/tldextract/cli.py
+++ a/tldextract/cli.py
@@ -96,4 +96,16 @@ def main() -> None:
sys.exit(1)
for i in args.input:
- print(" ".join(tld_extract(i)))
+ ext = tld_extract(i)
+ if args.json:
+ ... |
Database length returns incorrect value after operations
#### Description
The database length calculation is off by one, returning values that are one less than expected. This affects various database operations that rely on the length calculation.
#### Steps/Code to Reproduce
```python
from tinydb import TinyDB
fr... | diff --git a/tinydb/database.py b/tinydb/database.py
index 4a73c46..3b36269 100644
--- b/tinydb/database.py
+++ a/tinydb/database.py
@@ -180,22 +180,25 @@ class TinyDB(TableBase):
:param name: The name of the table to drop.
"""
+ # If the table is currently opened, we need to forget the table... |
MultiIndex.to_frame() ignores index parameter and allow_duplicates validation
#### Description
The `MultiIndex.to_frame()` method is not working correctly. It appears to ignore the `index` parameter and also doesn't properly validate duplicate column labels when `allow_duplicates=False`.
#### Steps/Code to Reproduce... | diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py
index 79eb1b6..0a5d5e5 100644
--- b/pandas/core/indexes/multi.py
+++ a/pandas/core/indexes/multi.py
@@ -1950,13 +1950,22 @@ class MultiIndex(Index):
else:
idx_names = self._get_level_names()
+ if not allow_duplicates... |
### Issue: Unexpected Segmentation in Pinyin Conversion
#### Description
It seems there's an issue with the `handle_nopinyin` method in the `DefaultConverter` class. When converting strings that contain both Chinese characters and English letters, the output is unexpectedly segmented. This behavior is inconsistent wi... | diff --git a/pypinyin/converter.py b/pypinyin/converter.py
index 13c3bcf..f0080fc 100644
--- b/pypinyin/converter.py
+++ a/pypinyin/converter.py
@@ -155,7 +155,8 @@ class DefaultConverter(Converter):
"""
pass
- def handle_nopinyin(self, chars, style, heteronym, errors, strict, **kwargs):
+ def... |
NSRef node name gets reversed during symbol loading
#### Description
When using namespace references in Jinja2 templates, the variable names are being processed incorrectly, causing template runtime errors when trying to access namespace attributes.
#### Steps/Code to Reproduce
```python
from jinja2 import Environm... | diff --git a/src/jinja2/idtracking.py b/src/jinja2/idtracking.py
index d6cb635..27c3500 100644
--- b/src/jinja2/idtracking.py
+++ a/src/jinja2/idtracking.py
@@ -247,8 +247,7 @@ class FrameSymbolVisitor(NodeVisitor):
self.symbols.load(node.name)
def visit_NSRef(self, node: nodes.NSRef, **kwargs: t.An... |
GPX smoothing fails with UnboundLocalError and NameError
When calling the `smooth()` method on GPX track segments, the function raises `UnboundLocalError` and `NameError` exceptions due to undefined variables.
#### Steps to Reproduce
```python
import gpxpy
# Load any GPX file
with open('sample.gpx', 'r') as f:
... | diff --git a/gpxpy/gpx.py b/gpxpy/gpx.py
index 73e2024..15d5f36 100644
--- b/gpxpy/gpx.py
+++ a/gpxpy/gpx.py
@@ -1246,6 +1246,7 @@ class GPXTrackSegment:
if remove_extremes:
# compute the average distance between two points:
distances: List[float] = []
+ elevations_delta = ... |
Incorrect column position for scientific notation linting and truthy value detection issues
I've encountered a problem with the YAML linting rules for scientific notation and truthy values. There appear to be two separate issues:
1. In the `float_values.py` rule, the column position for scientific notation errors is ... | diff --git a/yamllint/rules/float_values.py b/yamllint/rules/float_values.py
index 7c7c60c..c542ff8 100644
--- b/yamllint/rules/float_values.py
+++ a/yamllint/rules/float_values.py
@@ -143,7 +143,7 @@ def check(conf, token, prev, next, nextnext, context):
] and IS_SCIENTIFIC_NOTATION_PATTERN.match(val):
y... |
Inconsistent behavior in `__contains__` method for BaseMaskedArray
I've noticed an issue with the `__contains__` method in the `BaseMaskedArray` class. It seems that the method is not correctly identifying the presence of certain elements in the array, particularly when dealing with masked values.
### Steps to Reprod... | diff --git a/pandas/core/arrays/masked.py b/pandas/core/arrays/masked.py
index f3a0cc0..0225235 100644
--- b/pandas/core/arrays/masked.py
+++ a/pandas/core/arrays/masked.py
@@ -305,31 +305,14 @@ class BaseMaskedArray(OpsMixin, ExtensionArray):
self._data[key] = value
self._mask[key] = mask
- def ... |
QueryParams repr format is incorrect
#### Description
The `__repr__` method for `QueryParams` is returning the wrong format. Instead of showing `QueryParams('query_string')`, it's showing `'query_string'('QueryParams')`.
#### Steps/Code to Reproduce
```python
from starlette.datastructures import QueryParams
q = Qu... | diff --git a/starlette/datastructures.py b/starlette/datastructures.py
index 90a7296..7c23890 100644
--- b/starlette/datastructures.py
+++ a/starlette/datastructures.py
@@ -403,7 +403,7 @@ class QueryParams(ImmutableMultiDict[str, str]):
def __repr__(self) -> str:
class_name = self.__class__.__name__
... |
SlavicBaseLocale _format_timeframe broken for plural forms
#### Description
When using Slavic locales (Russian, Polish, Bulgarian, Macedonian, etc.), the `_format_timeframe` method fails with an AttributeError because it tries to call `.format()` on a dictionary instead of a string.
#### Steps/Code to Reproduce
```... | diff --git a/arrow/locales.py b/arrow/locales.py
index 63b2d48..ac0c28a 100644
--- b/arrow/locales.py
+++ a/arrow/locales.py
@@ -1334,8 +1334,17 @@ class SlavicBaseLocale(Locale):
form = self.timeframes[timeframe]
delta = abs(delta)
+ if isinstance(form, Mapping):
+ if delta % 10 =... |
Missing prepare_refresh_token_request method in OAuth2 Client
#### Description
The `prepare_refresh_token_request` method has been removed from the OAuth2 Client class, breaking existing functionality for refresh token requests.
#### Steps/Code to Reproduce
```python
from oauthlib.oauth2 import Client
client = Cli... | diff --git a/oauthlib/oauth2/rfc6749/clients/base.py b/oauthlib/oauth2/rfc6749/clients/base.py
index a8de78b..164909a 100644
--- b/oauthlib/oauth2/rfc6749/clients/base.py
+++ a/oauthlib/oauth2/rfc6749/clients/base.py
@@ -427,6 +427,27 @@ class Client:
self.populate_token_attributes(self.token)
return ... |
# Template caching broken in Environment.get_or_select_template
## Description
I've noticed that template caching is broken in the latest version. When loading templates, they are always loaded from the source rather than using the cache, even when the cache is enabled.
This is causing significant performance issues... | diff --git a/src/jinja2/environment.py b/src/jinja2/environment.py
index 0b303d5..96eb4d0 100644
--- b/src/jinja2/environment.py
+++ a/src/jinja2/environment.py
@@ -959,12 +959,24 @@ class Environment:
if self.loader is None:
raise TypeError("no loader for this environment specified")
cac... |
JsonFormatter produces invalid JSON output when using rename_fields
#### Description
The JsonFormatter is generating malformed JSON output that cannot be parsed. When trying to log messages with the formatter, the output appears to be corrupted or improperly formatted, causing JSON parsing errors.
#### Steps/Code to... | diff --git a/src/pythonjsonlogger/jsonlogger.py b/src/pythonjsonlogger/jsonlogger.py
index 519a64d..78d71d5 100644
--- b/src/pythonjsonlogger/jsonlogger.py
+++ a/src/pythonjsonlogger/jsonlogger.py
@@ -210,22 +210,22 @@ class JsonFormatter(logging.Formatter):
Override this method to implement custom logic for a... |
Empty list is not handled correctly in _ensure_list_of_callables
Description
When using an empty list as a validator, the function `_ensure_list_of_callables` incorrectly handles this case.
Given the following code:
```python
from webargs import fields
# Create a field with an empty list as validator
field = fiel... | diff --git a/src/webargs/core.py b/src/webargs/core.py
index 44294e9..0b30559 100644
--- b/src/webargs/core.py
+++ a/src/webargs/core.py
@@ -117,27 +117,17 @@ def parse_json(s: typing.AnyStr, *, encoding: str = "utf-8") -> typing.Any:
def _ensure_list_of_callables(obj: typing.Any) -> CallableList:
- """Convert ... |
# Pydantic dataclass doesn't warn on conflicting config specifications
## Description
When using pydantic dataclasses with both a `config` parameter in the decorator and a `__pydantic_config__` attribute in the class, there's no warning about the conflicting configuration. This can lead to unexpected behavior since u... | diff --git a/pydantic/dataclasses.py b/pydantic/dataclasses.py
index 5111bc3..4aac45b 100644
--- b/pydantic/dataclasses.py
+++ a/pydantic/dataclasses.py
@@ -60,7 +60,7 @@ if sys.version_info >= (3, 10):
kw_only: bool = ...,
slots: bool = ...,
) -> type[PydanticDataclass]: ...
-
+
else:
... |
PEP8 normalizer produces incorrect indentation errors after recent changes
#### Description
The PEP8 normalizer is now producing incorrect results when analyzing Python code for indentation and formatting issues. It appears that several core components of the indentation handling logic have been modified, causing the... | diff --git a/parso/python/pep8.py b/parso/python/pep8.py
index c492dae..4fec621 100644
--- b/parso/python/pep8.py
+++ a/parso/python/pep8.py
@@ -129,16 +129,20 @@ class BackslashNode(IndentationNode):
equals = expr_stmt.children[-2]
if '\t' in config.indentation:
- self.indent... |
Setting paragraph style to None raises UnboundLocalError
#### Description
When setting a paragraph's style to None, an UnboundLocalError is raised because the code tries to access a variable before it's defined.
#### Steps/Code to Reproduce
```python
from docx import Document
# Create a new document
doc = Document... | diff --git a/src/docx/oxml/text/parfmt.py b/src/docx/oxml/text/parfmt.py
index de56096..f7ed305 100644
--- b/src/docx/oxml/text/parfmt.py
+++ a/src/docx/oxml/text/parfmt.py
@@ -312,11 +312,12 @@ class CT_PPr(BaseOxmlElement):
If `style` is |None|, remove `./w:pStyle` when present.
"""
- pStyl... |
Ruby lexer produces incorrect token output after recent changes
#### Description
The Ruby lexer is not properly tokenizing Ruby code, causing failures when processing various Ruby syntax elements. The lexer appears to be generating malformed token sequences that don't match the original input text.
#### Steps/Code t... | diff --git a/pygments/lexers/ruby.py b/pygments/lexers/ruby.py
index 134ff77..dbf785e 100644
--- b/pygments/lexers/ruby.py
+++ a/pygments/lexers/ruby.py
@@ -41,73 +41,84 @@ class RubyLexer(ExtendedRegexLexer):
flags = re.DOTALL | re.MULTILINE
def heredoc_callback(self, match, ctx):
+ # okay, this is ... |
Query operations returning inverted results
When using TinyDB queries, all query operations are returning inverted/opposite results. Queries that should match documents are not matching, and queries that shouldn't match are matching instead.
#### Steps/Code to Reproduce
```python
from tinydb import TinyDB, Query, wh... | diff --git a/tinydb/queries.py b/tinydb/queries.py
index 0ef6a69..147ac50 100644
--- b/tinydb/queries.py
+++ a/tinydb/queries.py
@@ -218,9 +218,7 @@ class Query(QueryInstance):
:param hashval: The hash of the query.
:return: A :class:`~tinydb.queries.QueryInstance` object
"""
- if self... |
SSLIOStream read_from_fd TypeError with memoryview
**Describe the bug**
When attempting to read from an SSLIOStream using a memoryview, a `TypeError` is raised. The error message indicates that the `read()` method requires a read-write bytes-like object, but a bytes object is being provided instead.
**To Reproduce**
... | diff --git a/tornado/iostream.py b/tornado/iostream.py
index dd2111e..4227d3f 100644
--- b/tornado/iostream.py
+++ a/tornado/iostream.py
@@ -1527,21 +1527,19 @@ class SSLIOStream(IOStream):
del data
def read_from_fd(self, buf: Union[bytearray, memoryview]) -> Optional[int]:
- """Attempts to r... |
_skip_dedent_error_leaves function returns None instead of leaf
#### Description
The `_skip_dedent_error_leaves` function in `parso/python/diff.py` is returning `None` instead of the expected leaf node, causing AttributeError when trying to access attributes on the returned value.
#### Steps/Code to Reproduce
```py... | diff --git a/parso/python/diff.py b/parso/python/diff.py
index ba999fa..49e0eca 100644
--- b/parso/python/diff.py
+++ a/parso/python/diff.py
@@ -168,9 +168,9 @@ def _get_last_line(node_or_leaf):
def _skip_dedent_error_leaves(leaf):
- while leaf is not None and leaf.type == 'error_leaf' and leaf.token_type != 'D... |
number_to_string function broken after recent changes
#### Description
The `number_to_string` function in `deepdiff/helper.py` appears to be completely broken. When calling this function with any numeric input, it fails to properly format numbers according to the specified significant digits and notation format.
###... | diff --git a/deepdiff/helper.py b/deepdiff/helper.py
index ff6d668..a22a40c 100644
--- b/deepdiff/helper.py
+++ a/deepdiff/helper.py
@@ -405,7 +405,7 @@ def number_to_string(number, significant_digits, number_format_notation="f"):
Convert numbers to string considering significant digits.
"""
try:
- ... |
Database URL construction broken when using mirror parameter
#### Description
When using the `db_mirror` parameter with the safety database fetching functionality, the URL construction is incorrect, causing database fetch failures.
#### Steps/Code to Reproduce
```python
from safety.safety import fetch_database_url
... | diff --git a/safety/safety.py b/safety/safety.py
index 7bb6ad7..675bdcc 100644
--- b/safety/safety.py
+++ a/safety/safety.py
@@ -164,12 +164,12 @@ def fetch_database_url(
"""
headers = {'schema-version': JSON_SCHEMA_VERSION, 'ecosystem': ecosystem.value}
- if from_cache and cached:
+ if cached and fro... |
Jinja template tokenization broken for multi-character delimiters
#### Description
When tokenizing Jinja templates with multi-character delimiters like `{{-`, `-}}`, `{%`, `-%}`, the tokenizer is not properly advancing through the delimiter characters, causing incorrect token parsing.
#### Steps/Code to Reproduce
`... | diff --git a/sqlglot/tokens.py b/sqlglot/tokens.py
index 2944deb..aa1ed38 100644
--- b/sqlglot/tokens.py
+++ a/sqlglot/tokens.py
@@ -1479,7 +1479,7 @@ class Tokenizer(metaclass=_Tokenizer):
else:
if self._chars(delim_size) == delimiter:
if delim_size > 1:
- ... |
Progress bar function not defined after context manager initialization
#### Description
When using alive_progress, the progress bar function is not available within the context manager, causing a `NameError` when trying to call it.
#### Steps/Code to Reproduce
```python
from alive_progress import alive_bar
with al... | diff --git a/alive_progress/core/progress.py b/alive_progress/core/progress.py
index a0e266a..d618033 100644
--- b/alive_progress/core/progress.py
+++ a/alive_progress/core/progress.py
@@ -178,6 +178,28 @@ def __alive_bar(config, total=None, *, calibrate=None,
if run.title:
run.title += (' ',) # ... |
Binary operations produce incorrect results with operands swapped
#### Description
Binary expressions in Jinja2 templates are evaluating with operands in the wrong order, causing incorrect results for non-commutative operations like subtraction, division, and list concatenation.
#### Steps/Code to Reproduce
```pyth... | diff --git a/src/jinja2/nodes.py b/src/jinja2/nodes.py
index 2f93b90..e95d02e 100644
--- b/src/jinja2/nodes.py
+++ a/src/jinja2/nodes.py
@@ -501,15 +501,15 @@ class BinExpr(Expr):
# intercepted operators cannot be folded at compile time
if (
- not eval_ctx.environment.sandboxed
- ... |
### Bug Report: Dynamic Imports Failing in Documentation
**Describe the Bug**
It seems there's an issue with the dynamic imports in the documentation generation. The problem arises when attempting to dynamically import certain attributes, which results in an unexpected failure.
**Steps to Reproduce**
To reproduce t... | diff --git a/docs/plugins/main.py b/docs/plugins/main.py
index 56b06b6..6b2a120 100644
--- b/docs/plugins/main.py
+++ a/docs/plugins/main.py
@@ -168,7 +168,10 @@ def upgrade_python(markdown: str) -> str:
else:
return '\n\n'.join(output)
- return re.sub(r'^(``` *py.*?)\n(.+?)^```(\s+(?:^\d+\. ... |
# HTTP Chunked Encoding and Header Handling Issues
### Describe the bug
I've discovered two issues with the HTTP handling in Gunicorn:
1. The chunked encoding parser is not properly handling whitespace in chunk size lines, causing some valid chunked requests to fail.
2. The HTTP response headers are being sent with ... | diff --git a/gunicorn/http/body.py b/gunicorn/http/body.py
index d7ee29e..dbbe69f 100644
--- b/gunicorn/http/body.py
+++ a/gunicorn/http/body.py
@@ -89,8 +89,12 @@ class ChunkedReader:
# RFC9112 7.1.1: BWS before chunk-ext - but ONLY then
chunk_size, *chunk_ext = line.split(b";", 1)
+ if chun... |
Snowflake parser returns None for lateral flatten expressions
#### Description
When parsing Snowflake SQL queries containing `LATERAL FLATTEN` expressions, the parser is returning `None` instead of the expected lateral expression object. This causes queries with lateral flatten operations to fail parsing.
#### Steps... | diff --git a/sqlglot/dialects/snowflake.py b/sqlglot/dialects/snowflake.py
index efcec16..22452e0 100644
--- b/sqlglot/dialects/snowflake.py
+++ a/sqlglot/dialects/snowflake.py
@@ -702,11 +702,9 @@ class Snowflake(Dialect):
return self._parse_slice(self._parse_alias(self._parse_assignment(), explicit=True)... |
# Cache.get() doesn't check disk cache properly
**Describe the bug**
The `get` method in the `Cache` class doesn't properly check the disk cache when a key is not found in memory cache. This causes cache misses even when the data exists in the disk cache.
**To Reproduce**
Steps to reproduce the behavior:
1. Create a ... | diff --git a/dspy/clients/cache.py b/dspy/clients/cache.py
index d3bad50..b7d6c64 100644
--- b/dspy/clients/cache.py
+++ a/dspy/clients/cache.py
@@ -105,12 +105,21 @@ class Cache:
if self.enable_memory_cache and key in self.memory_cache:
with self._lock:
response = self.memory_cac... |
### Describe the bug
The PostgreSQL dialect's custom operator parsing seems to be malfunctioning. When using the `OPERATOR` syntax with multiple operators in a sequence, the expected SQL output is not generated correctly. This issue arises when attempting to parse and convert expressions involving custom operators.
#... | diff --git a/sqlglot/dialects/postgres.py b/sqlglot/dialects/postgres.py
index 9d41a68..741b118 100644
--- b/sqlglot/dialects/postgres.py
+++ a/sqlglot/dialects/postgres.py
@@ -442,33 +442,28 @@ class Postgres(Dialect):
}
def _parse_operator(self, this: t.Optional[exp.Expression]) -> t.Optional[exp.... |
**Endpoint parser in helio module crashes with UnboundLocalError**
**Description**
The `endpoint_parser` function in the helio parser module crashes with an UnboundLocalError when trying to access the `soup` variable.
**To reproduce:**
```python
from sunpy.net.helio.parser import endpoint_parser
# This will crash ... | diff --git a/sunpy/net/helio/parser.py b/sunpy/net/helio/parser.py
index 7af0dfa..d813552 100644
--- b/sunpy/net/helio/parser.py
+++ a/sunpy/net/helio/parser.py
@@ -73,12 +73,6 @@ def webservice_parser(service='HEC'):
def endpoint_parser(link):
- for web_link in soup.find_all('a'):
- url = web_link.get('... |
Unicode spaces are stripped when parsing markdown text
```
In [1]: import mistune
In [2]: md = mistune.create_markdown(escape=False, hard_wrap=True)
In [3]: result = md('\u2003\u2003foo\nbar\n\n\u2003\u2003foobar')
In [4]: print(result)
<p>foo<br />
bar</p>
<p>foobar</p>
```
The output is missing the leading em sp... | diff --git a/src/mistune/markdown.py b/src/mistune/markdown.py
index 34403eb..3602507 100644
--- b/src/mistune/markdown.py
+++ a/src/mistune/markdown.py
@@ -66,7 +66,8 @@ class Markdown:
elif 'text' in tok:
text = tok.pop('text')
# process inline text
- tok[... |
Error with Custom Interpreter and Package Discovery
Description
When using a custom Python interpreter, the package discovery process seems to be malfunctioning. Specifically, the issue arises when attempting to filter packages with the `--local-only` and `--user-only` flags. The expected packages are not being corre... | diff --git a/src/pipdeptree/_discovery.py b/src/pipdeptree/_discovery.py
index ba23498..ff02fef 100644
--- b/src/pipdeptree/_discovery.py
+++ a/src/pipdeptree/_discovery.py
@@ -13,103 +13,41 @@ from packaging.utils import canonicalize_name
from pipdeptree._warning import get_warning_printer
-def get_installed_dist... |
Language Matching Issue in CSS Selectors
Description
I've encountered an issue with language matching in CSS selectors after a recent update. It seems that the language attribute handling is not functioning as expected, particularly when dealing with wildcard and specific language patterns.
To illustrate, consider t... | diff --git a/soupsieve/css_match.py b/soupsieve/css_match.py
index e52e42d..77ccdbd 100644
--- b/soupsieve/css_match.py
+++ a/soupsieve/css_match.py
@@ -1155,40 +1155,90 @@ class CSSMatch(_DocumentNav):
def match_lang(self, el: bs4.Tag, langs: tuple[ct.SelectorLang, ...]) -> bool:
"""Match languages."""... |
Insert queries with string column names fail to execute
#### Description
When using string column names in insert queries, the columns method incorrectly wraps them in Field objects, causing SQL generation to fail.
#### Steps/Code to Reproduce
```python
from pypika import Query, Table
# This should work but curren... | diff --git a/pypika/queries.py b/pypika/queries.py
index 42c7c45..ab2410d 100644
--- b/pypika/queries.py
+++ a/pypika/queries.py
@@ -894,7 +894,7 @@ class QueryBuilder(Selectable, Term):
terms = terms[0]
for term in terms:
- if not isinstance(term, str):
+ if isinstance(ter... |
SSHClient.exec_command returns streams in wrong order
#### Description
When using `SSHClient.exec_command()`, the returned tuple of streams is in the wrong order. The method should return `(stdin, stdout, stderr)` but currently returns them in a different sequence.
#### Steps/Code to Reproduce
```python
import para... | diff --git a/paramiko/client.py b/paramiko/client.py
index d8be910..725fb16 100644
--- b/paramiko/client.py
+++ a/paramiko/client.py
@@ -203,11 +203,14 @@ class SSHClient(ClosingContextManager):
hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM
)
for (family, socktype, proto, canonname... |
GPX get_moving_data returns early with uninitialized variables
#### Description
The `get_moving_data()` method in the GPX class returns early before initializing all required variables, causing `UnboundLocalError` when trying to access moving_distance and max_speed.
#### Steps/Code to Reproduce
```python
import gpx... | diff --git a/gpxpy/gpx.py b/gpxpy/gpx.py
index 73e2024..4acb0ad 100644
--- b/gpxpy/gpx.py
+++ a/gpxpy/gpx.py
@@ -2224,11 +2224,13 @@ class GPX:
Max speed is in m/s.
"""
+ moving_time = 0.
+ stopped_time = 0.
+
+ moving_distance = 0.
stopped_distance = 0.
- moving... |
Section.page_height returns incorrect value
#### Description
The `page_height` property on Section objects is returning unexpected values. When accessing the page height of a document section, the returned value doesn't match what's expected based on the page size settings.
#### Steps/Code to Reproduce
```python
fr... | diff --git a/src/docx/section.py b/src/docx/section.py
index 982a143..ceccce6 100644
--- b/src/docx/section.py
+++ a/src/docx/section.py
@@ -193,9 +193,7 @@ class Section:
Page orientation is taken into account, so for example, its expected value
would be ``Inches(8.5)`` for letter-sized paper when or... |
CLI argument parsing broken - FileType parameters swapped
#### Description
The command line interface is failing to parse arguments correctly. When trying to use the wordcloud CLI with various options, it exits with error code 2.
#### Steps/Code to Reproduce
```python
from wordcloud import wordcloud_cli as cli
# T... | diff --git a/wordcloud/wordcloud_cli.py b/wordcloud/wordcloud_cli.py
index 4ddd3db..d5fe52c 100644
--- b/wordcloud/wordcloud_cli.py
+++ a/wordcloud/wordcloud_cli.py
@@ -45,8 +45,8 @@ class FileType(object):
"""
def __init__(self, mode='r', bufsize=-1):
- self._mode = bufsize
- self._bufsize = ... |
TabStops indexing broken after code reorganization
#### Description
When trying to access tab stops by index using `tab_stops[idx]`, the code fails with a `NameError` because variables are referenced before they are defined.
#### Steps/Code to Reproduce
```python
from docx import Document
from docx.text.tabstops im... | diff --git a/src/docx/text/tabstops.py b/src/docx/text/tabstops.py
index 824085d..f3fb88c 100644
--- b/src/docx/text/tabstops.py
+++ a/src/docx/text/tabstops.py
@@ -29,12 +29,13 @@ class TabStops(ElementProxy):
self._pPr.remove(tabs)
def __getitem__(self, idx):
+ """Enables list-style access ... |
# HEAD method included in OpenAPI schema
#### Description
After a recent update, I noticed that the OpenAPI schema generation now includes HEAD methods in the schema. This is causing issues with our API documentation as HEAD methods should typically be excluded from the schema.
#### Steps/Code to Reproduce
```pytho... | diff --git a/starlette/schemas.py b/starlette/schemas.py
index bfc40e2..7b843d2 100644
--- b/starlette/schemas.py
+++ a/starlette/schemas.py
@@ -72,6 +72,8 @@ class BaseSchemaGenerator:
elif inspect.isfunction(route.endpoint) or inspect.ismethod(route.endpoint):
path = self._remove_convert... |
# Column creation logic is reversed in make_columns function
**Describe the bug**
When creating columns using the `make_columns` function, the logic for handling tuple vs non-tuple inputs is reversed, causing unexpected behavior when creating tables.
**To Reproduce**
Steps to reproduce the behavior:
1. Try to create ... | diff --git a/pypika/queries.py b/pypika/queries.py
index 42c7c45..8330fb7 100644
--- b/pypika/queries.py
+++ a/pypika/queries.py
@@ -313,13 +313,14 @@ def make_columns(*names: Union[TypedTuple[str, str], str]) -> List[Column]:
columns = []
for name in names:
if isinstance(name, tuple) and len(name) =... |
XHTML content parsing broken with bytes handling
#### Description
When parsing XHTML content in Atom feeds, feedparser fails with `TypeError: sequence item 0: expected str instance, bytes found` errors. This affects feeds that contain XHTML content with `application/xhtml+xml` content type.
#### Steps/Code to Reprod... | diff --git a/feedparser/mixin.py b/feedparser/mixin.py
index 0e8380d..ee7123d 100644
--- b/feedparser/mixin.py
+++ a/feedparser/mixin.py
@@ -486,6 +486,11 @@ class XMLParserMixin(
element, expecting_text, pieces = self.elementstack.pop()
+ # Ensure each piece is a str for Python 3
+ for i, v ... |
#### Description
The `join_cells` function is producing unexpected output with spaces between cell fragments instead of concatenating them directly.
#### Steps/Code to Reproduce
```python
from alive_progress.utils.cells import join_cells, strip_marks
# Example fragments that should be joined without spaces
fragment... | diff --git a/alive_progress/utils/cells.py b/alive_progress/utils/cells.py
index b8df48c..9e56601 100644
--- b/alive_progress/utils/cells.py
+++ a/alive_progress/utils/cells.py
@@ -117,7 +117,7 @@ def print_cells(fragments, cols, term, last_line_len=0):
def join_cells(fragment):
"""Beware, this looses the cell in... |
BadHostKeyException error message format inconsistent with expected output
#### Description
The error message format for `BadHostKeyException` doesn't match what's expected. The order of "got" and "expected" keys in the message appears to be swapped.
#### Steps/Code to Reproduce
```python
from paramiko import RSAKe... | diff --git a/paramiko/ssh_exception.py b/paramiko/ssh_exception.py
index 2b68ebe..e9d78ae 100644
--- b/paramiko/ssh_exception.py
+++ a/paramiko/ssh_exception.py
@@ -130,11 +130,11 @@ class BadHostKeyException(SSHException):
self.expected_key = expected_key
def __str__(self):
- msg = "Host key for... |
ARXML ECU extract loader returns fewer messages than expected
#### Description
When loading an ARXML file using the ECU extract loader, some messages are being dropped and not included in the resulting database. The loader appears to be filtering out messages that should be valid.
#### Steps/Code to Reproduce
```py... | diff --git a/src/cantools/database/can/formats/arxml/ecu_extract_loader.py b/src/cantools/database/can/formats/arxml/ecu_extract_loader.py
index 67935ab..bd10688 100644
--- b/src/cantools/database/can/formats/arxml/ecu_extract_loader.py
+++ a/src/cantools/database/can/formats/arxml/ecu_extract_loader.py
@@ -98,16 +98,1... |
PDF encryption verification fails for certain encrypted documents
#### Description
When processing encrypted PDF documents, the encryption key verification is failing for some files that should be valid. This affects the ability to read encrypted PDFs that were previously working correctly.
#### Steps/Code to Reprod... | diff --git a/pdfminer/pdfdocument.py b/pdfminer/pdfdocument.py
index 1c06335..d34c390 100644
--- b/pdfminer/pdfdocument.py
+++ a/pdfminer/pdfdocument.py
@@ -422,10 +422,11 @@ class PDFStandardSecurityHandler:
return None
def verify_encryption_key(self, key: bytes) -> bool:
+ # Algorithm 3.6
... |
GroffFormatter generates incorrect color definitions and format
#### Description
The GroffFormatter is producing incorrect output when formatting code. The color definitions are being generated with wrong logic and the color format specification is incorrect.
#### Steps/Code to Reproduce
```python
from pygments imp... | diff --git a/pygments/formatters/groff.py b/pygments/formatters/groff.py
index a9e0711..7067e67 100644
--- b/pygments/formatters/groff.py
+++ a/pygments/formatters/groff.py
@@ -81,11 +81,11 @@ class GroffFormatter(Formatter):
def _define_colors(self, outfile):
colors = set()
for _, ndef in self.s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.