anchor
stringlengths
10
14.3k
positive
stringlengths
10
14.9k
get_flags_from_context() returns empty dict due to variable initialization order #### Description The `get_flags_from_context()` function in `safety/util.py` always returns an empty dictionary because the `flags` variable is initialized after the code that populates it. #### Steps/Code to Reproduce ```python from s...
diff --git a/safety/util.py b/safety/util.py index 420eb13..4c5170a 100644 --- b/safety/util.py +++ a/safety/util.py @@ -189,22 +189,23 @@ def get_license_name_by_id(license_id: int, db: Dict[str, Any]) -> Optional[str] def get_flags_from_context() -> Dict[str, str]: + """ + Get the flags from the current cl...
Template compilation fails with UndefinedError for variable references #### Description After recent changes, Jinja2 templates are failing to compile and render properly, throwing `UndefinedError` exceptions for variables that should be accessible in the template context. This affects basic variable resolution and te...
diff --git a/src/jinja2/idtracking.py b/src/jinja2/idtracking.py index d6cb635..bcafba0 100644 --- b/src/jinja2/idtracking.py +++ a/src/jinja2/idtracking.py @@ -235,6 +235,17 @@ class FrameSymbolVisitor(NodeVisitor): def __init__(self, symbols: "Symbols") -> None: self.symbols = symbols + def visit_N...
Database format detection broken - wrong parsers called for file formats #### Description When loading database files, the format detection logic is calling the wrong parsers for different file formats. This causes files to fail parsing with syntax errors even when they should be valid for their respective formats. ...
diff --git a/src/cantools/database/__init__.py b/src/cantools/database/__init__.py index 701b1bc..6d2e75e 100644 --- b/src/cantools/database/__init__.py +++ a/src/cantools/database/__init__.py @@ -331,22 +331,21 @@ def load_string(string: str, def load_can_database(fmt: str) -> can.Database: db = can.Da...
# JSONAdapter fails when using structured outputs with certain models ## Description I've encountered an issue with the `JSONAdapter` when using structured outputs with certain models. The adapter is not properly handling the case when a model supports the `response_format` parameter. ## To reproduce: Create a simp...
diff --git a/dspy/adapters/json_adapter.py b/dspy/adapters/json_adapter.py index 14c5230..d7d5fa4 100644 --- b/dspy/adapters/json_adapter.py +++ a/dspy/adapters/json_adapter.py @@ -45,21 +45,10 @@ class JSONAdapter(ChatAdapter): inputs: dict[str, Any], ) -> list[dict[str, Any]]: provider = lm.mod...
Parser location argument case sensitivity breaks custom location loaders #### Description When using custom location loaders with the `@parser.location_loader` decorator, the parser fails to recognize locations that don't match the exact case. The location validation now converts the location to lowercase, but the lo...
diff --git a/src/webargs/core.py b/src/webargs/core.py index 44294e9..eebfdec 100644 --- b/src/webargs/core.py +++ a/src/webargs/core.py @@ -212,7 +212,7 @@ class Parser(typing.Generic[Request]): :raises: ValueError if a given location is invalid. """ valid_locations = set(self.__location_map...
Dataclass __init__ generation broken with UnboundLocalError #### Description When using dataclasses, the generated `__init__` method fails with `UnboundLocalError` for various local variables that are referenced before assignment. #### Steps/Code to Reproduce ```python from dataclasses import dataclass @dataclass ...
diff --git a/astroid/brain/brain_dataclasses.py b/astroid/brain/brain_dataclasses.py index 92d983e..2f28650 100644 --- b/astroid/brain/brain_dataclasses.py +++ a/astroid/brain/brain_dataclasses.py @@ -248,6 +248,8 @@ def _generate_dataclass_init( kw_only_params: list[str] = [] assignments: list[str] = [] + ...
Headers equality comparison fails with AttributeError when comparing to non-Headers objects #### Description When comparing a `Headers` instance to an object that doesn't have a `_list` attribute, an `AttributeError` is raised instead of returning `False`. #### Steps/Code to Reproduce ```python from starlette.datas...
diff --git a/starlette/datastructures.py b/starlette/datastructures.py index 90a7296..32d49e2 100644 --- b/starlette/datastructures.py +++ a/starlette/datastructures.py @@ -552,9 +552,10 @@ class Headers(typing.Mapping[str, str]): return len(self._list) def __eq__(self, other: typing.Any) -> bool: - ...
# DVC used_objs method doesn't process targets correctly The `used_objs` method in the Repo class doesn't properly handle the `targets` parameter. When specifying a target path, the method ignores it and collects all objects from all stages instead of just the ones related to the target. ## Reproduction ```python im...
diff --git a/dvc/repo/__init__.py b/dvc/repo/__init__.py index 2b89626..a18b2af 100644 --- b/dvc/repo/__init__.py +++ a/dvc/repo/__init__.py @@ -471,11 +471,25 @@ class Repo: return switch(self, rev) - def used_objs(self, targets=None, all_branches=False, with_deps=False, - all_tags=False, all_co...
WebApplicationServer and MobileApplicationServer initialization broken #### Description The pre-configured OAuth2 server classes are not working properly. When trying to use `WebApplicationServer` or `MobileApplicationServer`, they fail to initialize correctly and don't handle OAuth2 flows as expected. #### Steps/Co...
diff --git a/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py b/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py index d64a166..11f44d2 100644 --- b/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py +++ a/oauthlib/oauth2/rfc6749/endpoints/pre_configured.py @@ -92,21 +92,21 @@ class WebApplicationServer(Authoriz...
Text preprocessing produces reversed output #### Description The text preprocessing functions in the tokenizer are returning reversed strings instead of the expected output. This affects all text processing operations including substitutions, regex preprocessing, and tokenization. #### Steps/Code to Reproduce ```py...
diff --git a/gtts/tokenizer/core.py b/gtts/tokenizer/core.py index d7e0a4e..5683698 100644 --- b/gtts/tokenizer/core.py +++ a/gtts/tokenizer/core.py @@ -135,9 +135,9 @@ class PreProcessorRegex: applied. """ - for regex in reversed(self.regexes): + for regex in self.regexes: ...
Instrumentation path order reversed causing incorrect qualified names #### Description When using typeguard's instrumentation, the qualified names for nested functions and classes are being generated in reverse order, causing instrumentation errors. #### Steps/Code to Reproduce ```python from typeguard import typec...
diff --git a/src/typeguard/_transformer.py b/src/typeguard/_transformer.py index 25696a5..b15e710 100644 --- b/src/typeguard/_transformer.py +++ a/src/typeguard/_transformer.py @@ -511,9 +511,9 @@ class TypeguardTransformer(NodeTransformer): @contextmanager def _use_memo( - self, node: FunctionDef | ...
Error with a certain version constraint format ### What pipdeptree version are you using? 2.17.0 ### Are you running pipdeptree in a virtual environment? - [ ] Yes ### Describe the problem Thank you for developing a great library! We use `pipdeptree` in our CIs, and it fails in v2.17.0 but passes in v2.16.2. h...
diff --git a/src/pipdeptree/_models/dag.py b/src/pipdeptree/_models/dag.py index 2f5df60..7749400 100644 --- b/src/pipdeptree/_models/dag.py +++ a/src/pipdeptree/_models/dag.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys from collections import defaultdict, deque from fnmatch import fnmatch fro...
RequestHandler.write() method not returning data for non-HEAD requests #### Description The `write()` method in `RequestHandler` is not properly writing chunks to the connection. When calling `write()` on a request handler, the data is not being sent to the client. #### Steps/Code to Reproduce ```python import torn...
diff --git a/tornado/web.py b/tornado/web.py index 357c5f1..f8480b5 100644 --- b/tornado/web.py +++ a/tornado/web.py @@ -1222,6 +1222,14 @@ class RequestHandler: else: for transform in self._transforms: chunk = transform.transform_chunk(chunk, include_footers) + # Ignor...
Contract callback execution order broken after refactoring #### Description The contract system is not working properly - callbacks are being executed before the pre-processing tests run, causing contract validation to fail. #### Steps/Code to Reproduce ```python from scrapy.spiders import Spider from scrapy.http i...
diff --git a/scrapy/contracts/__init__.py b/scrapy/contracts/__init__.py index bdb68c4..33a9732 100644 --- b/scrapy/contracts/__init__.py +++ a/scrapy/contracts/__init__.py @@ -39,8 +39,6 @@ class Contract: @wraps(cb) def wrapper(response: Response, **cb_kwargs: Any) -> list[Any]: - ...
QR code image save fails with "unknown file extension" error #### Description When trying to save QR code images to BytesIO streams, the save operation fails with a "ValueError: unknown file extension" error. This affects both PIL and PyPNG image backends. #### Steps/Code to Reproduce ```python import qrcode import...
diff --git a/qrcode/image/pil.py b/qrcode/image/pil.py index 57ee13a..fdd9740 100644 --- b/qrcode/image/pil.py +++ a/qrcode/image/pil.py @@ -49,8 +49,9 @@ class PilImage(qrcode.image.base.BaseImage): def save(self, stream, format=None, **kwargs): kind = kwargs.pop("kind", self.kind) - self._img.s...
SQL formatting with reindent=True produces AttributeError #### Description When using `sqlparse.format()` with `reindent=True`, an AttributeError is raised indicating that a 'list' object has no attribute 'token_next_by'. #### Steps/Code to Reproduce ```python import sqlparse # Simple SQL formatting with reindent ...
diff --git a/sqlparse/filters/reindent.py b/sqlparse/filters/reindent.py index 7dc2b82..14a80bb 100644 --- b/sqlparse/filters/reindent.py +++ a/sqlparse/filters/reindent.py @@ -98,8 +98,8 @@ class ReindentFilter: def _process(self, tlist): func_name = '_process_{cls}'.format(cls=type(tlist).__name__) - ...
Hive parameter parsing broken with UnboundLocalError #### Description When parsing Hive SQL with parameters, the parser raises an `UnboundLocalError` for local variables `this` and `expression`. #### Steps/Code to Reproduce ```python import sqlglot # This should parse successfully but raises UnboundLocalError sql ...
diff --git a/sqlglot/dialects/hive.py b/sqlglot/dialects/hive.py index 6084d44..10a0b91 100644 --- b/sqlglot/dialects/hive.py +++ a/sqlglot/dialects/hive.py @@ -435,13 +435,14 @@ class Hive(Dialect): ) def _parse_parameter(self) -> exp.Parameter: - self._match(TokenType.R_BRACE) - ...
NameError in concat function when joining DataFrames #### Description When concatenating DataFrames, a `NameError` occurs because the variable `first` is referenced but not defined in the `_is_uniform_join_units` function. #### Steps/Code to Reproduce ```python import pandas as pd import numpy as np # Create two D...
diff --git a/pandas/core/internals/concat.py b/pandas/core/internals/concat.py index 2ee7d39..f8e7e1e 100644 --- b/pandas/core/internals/concat.py +++ a/pandas/core/internals/concat.py @@ -457,6 +457,7 @@ def _is_uniform_join_units(join_units: list[JoinUnit]) -> bool: _concatenate_join_units (which uses `concat_co...
### Issue with HTTP Parser Handling Invalid Requests #### Current Problem It seems that the recent changes to the HTTP parser have introduced an issue where invalid HTTP requests are not being handled correctly. This results in a failure to process certain malformed requests, which previously would have been managed ...
diff --git a/gunicorn/http/parser.py b/gunicorn/http/parser.py index 88da17a..ff112ee 100644 --- b/gunicorn/http/parser.py +++ a/gunicorn/http/parser.py @@ -26,24 +26,23 @@ class Parser: return self def __next__(self): - """TODO: Implement this function""" - if self.mesg and not self.mesg....
Image part reuse broken after recent changes #### Description When adding images to a presentation, the library is supposed to reuse existing image parts if the same image (by SHA1 hash) already exists in the package. However, this functionality appears to be broken - instead of returning the existing image part when...
diff --git a/src/pptx/package.py b/src/pptx/package.py index 79703cd..53f0366 100644 --- b/src/pptx/package.py +++ a/src/pptx/package.py @@ -35,7 +35,7 @@ class Package(OpcPackage): the image part already exists in this package, it is reused, otherwise a new one is created. """ - retur...