anchor stringlengths 10 14.3k | positive stringlengths 10 14.9k |
|---|---|
[feature] Support multiple words
Such as:
```sh
$ pypinyin -sz 你好 您好
nh
nh
``` | diff --git a/pypinyin/runner.py b/pypinyin/runner.py
index 208903f..81a9046 100644
--- b/pypinyin/runner.py
+++ a/pypinyin/runner.py
@@ -77,7 +77,7 @@ def get_parser():
parser.add_argument('-m', '--heteronym', help='enable heteronym',
action='store_true')
# 要查询的汉字
- parser.add_argu... |
SchemaErrorMessage.format() concatenates args incorrectly
#### Description
When using `SchemaErrorMessage.format()` with arguments, the method incorrectly concatenates all arguments together before the original message string, causing malformed error messages in trivia schema validation.
#### Steps/Code to Reproduce... | diff --git a/redbot/cogs/trivia/schema.py b/redbot/cogs/trivia/schema.py
index 6206a37..b0218d3 100644
--- b/redbot/cogs/trivia/schema.py
+++ a/redbot/cogs/trivia/schema.py
@@ -15,7 +15,7 @@ KEY_ERROR_MSG_RE = re.compile(r"Key '(.+)' error:")
class SchemaErrorMessage(str):
def format(self, *args: Any, **kwargs:... |
# Erlang Shell Lexer and Elixir Lexer Broken
## Bug Description
I've discovered multiple issues with the Erlang Shell Lexer and Elixir Lexer in the latest version. The lexers are not correctly processing input, which causes incorrect syntax highlighting and token generation.
## Erlang Shell Lexer Issue
The Erlang S... | diff --git a/pygments/lexers/erlang.py b/pygments/lexers/erlang.py
index 1190182..46fc0fb 100644
--- b/pygments/lexers/erlang.py
+++ a/pygments/lexers/erlang.py
@@ -161,28 +161,28 @@ class ErlangShellLexer(Lexer):
def get_tokens_unprocessed(self, text):
erlexer = ErlangLexer(**self.options)
-
+
... |
SJIS encoding detection fails for certain Japanese text files
#### Description
When trying to detect SJIS (Shift_JIS) encoded Japanese text, chardet returns `None` for encoding instead of correctly identifying it as SJIS. This affects the ability to properly decode Japanese text files.
#### Steps/Code to Reproduce
... | diff --git a/chardet/sjisprober.py b/chardet/sjisprober.py
index 91df077..43bc311 100644
--- b/chardet/sjisprober.py
+++ a/chardet/sjisprober.py
@@ -73,6 +73,19 @@ class SJISProber(MultiByteCharSetProber):
if coding_state == MachineState.ITS_ME:
self._state = ProbingState.FOUND_IT
... |
MIDI file parsing fails silently on EOF instead of raising proper error
#### Description
When reading MIDI files that are truncated or have unexpected end-of-file conditions, the parser now returns 0 instead of raising an EOFError. This causes silent failures where corrupted or incomplete MIDI files appear to parse s... | diff --git a/mido/midifiles/midifiles.py b/mido/midifiles/midifiles.py
index bd8fac5..5f6e3bd 100644
--- b/mido/midifiles/midifiles.py
+++ a/mido/midifiles/midifiles.py
@@ -65,9 +65,9 @@ class DebugFileWrapper:
def read_byte(self):
byte = self.read(1)
if byte == b'':
- return 0
+ raise EOFError... |
DiffParser returns integer instead of node in _get_old_line_stmt
When using the DiffParser, the `_get_old_line_stmt` method is returning an integer `0` instead of a proper node object in certain cases. This causes AttributeError when the returned value is used as if it were a node.
#### Steps/Code to Reproduce
```py... | diff --git a/parso/python/diff.py b/parso/python/diff.py
index ba999fa..3d43278 100644
--- b/parso/python/diff.py
+++ a/parso/python/diff.py
@@ -65,11 +65,11 @@ def _get_next_leaf_if_indentation(leaf):
def _get_suite_indentation(tree_node):
- return _get_indentation(tree_node.children[0])
+ return _get_inden... |
Progress bar borders not displaying correctly for certain percentage values
#### Description
When using progress bars with specific percentage values, the border display behavior is incorrect. The borders appear when they shouldn't and don't appear when they should.
#### Steps/Code to Reproduce
```python
from alive... | diff --git a/alive_progress/animations/bars.py b/alive_progress/animations/bars.py
index e2e5359..833c577 100644
--- b/alive_progress/animations/bars.py
+++ a/alive_progress/animations/bars.py
@@ -66,16 +66,16 @@ def bar_factory(chars=None, *, tip=None, background=None, borders=None, errors=N
@bordered(borde... |
# Validation set check logic is inverted in MIPROv2
## Description
I found a bug in the MIPROv2 class where the validation set check logic is inverted. When a validation set is provided, the code doesn't check if it has at least 1 example. Instead, it checks this condition only when the validation set is None, which ... | diff --git a/dspy/teleprompt/mipro_optimizer_v2.py b/dspy/teleprompt/mipro_optimizer_v2.py
index 711b227..3f741a8 100644
--- b/dspy/teleprompt/mipro_optimizer_v2.py
+++ a/dspy/teleprompt/mipro_optimizer_v2.py
@@ -258,17 +258,18 @@ class MIPROv2(Teleprompter):
raise ValueError("Trainset cannot be empty.")
... |
Unexpected Behavior in Differential Rotation Observer Handling
Description
After applying the recent changes to the differential rotation module, I've encountered an issue with the observer handling logic. Specifically, the expected warnings related to the observer's assumptions are not being triggered, which could l... | diff --git a/sunpy/physics/differential_rotation.py b/sunpy/physics/differential_rotation.py
index e4f3f4a..82c5696 100644
--- b/sunpy/physics/differential_rotation.py
+++ a/sunpy/physics/differential_rotation.py
@@ -140,33 +140,19 @@ def _get_new_observer(initial_obstime, observer, time):
is not None the outp... |
Test fixture `works_not_in_py` returns incorrect error checking behavior
#### Description
The `works_not_in_py` fixture is not working as expected. When testing Python syntax that should fail in newer Python versions (like Python 2 style raise statements, old octal notation, etc.), the fixture is incorrectly handling... | diff --git a/conftest.py b/conftest.py
index 35a1846..9d0ab3c 100644
--- b/conftest.py
+++ a/conftest.py
@@ -109,9 +109,9 @@ class Checker:
def get_error(self, code):
errors = list(self.grammar.iter_errors(self.grammar.parse(code)))
- assert bool(errors) == self._is_passing # Altered the logical... |
Slavic locale timeframe formatting broken after recent changes
#### Description
The `_format_timeframe` method for Slavic locales is no longer working properly. When trying to format timeframes for Slavic languages like Russian, Polish, Bulgarian, etc., an AttributeError is raised saying `'dict' object has no attribu... | diff --git a/arrow/locales.py b/arrow/locales.py
index 63b2d48..ea8f9b7 100644
--- b/arrow/locales.py
+++ a/arrow/locales.py
@@ -1330,6 +1330,21 @@ class DutchLocale(Locale):
class SlavicBaseLocale(Locale):
timeframes: ClassVar[Mapping[TimeFrameLiteral, Union[str, Mapping[str, str]]]]
+ def _format_timeframe... |
Grammar normalizer config logic inverted causing syntax errors to be ignored
#### Description
When using parso to parse Python code with syntax errors, the errors are not being detected properly. Code that should raise syntax errors is being parsed without any error messages.
#### Steps/Code to Reproduce
```python
... | diff --git a/parso/grammar.py b/parso/grammar.py
index 85c65db..7b11b02 100644
--- b/parso/grammar.py
+++ a/parso/grammar.py
@@ -183,7 +183,7 @@ class Grammar(Generic[_NodeT]):
return RefactoringNormalizer(node_to_str_map).walk(base_node)
def _get_normalizer(self, normalizer_config):
- if normali... |
Callback check logic broken for input ports
#### Description
Input ports are incorrectly raising ValueError about callback being set even when no callback is actually configured.
#### Steps/Code to Reproduce
```python
import mido
# Try to create an input port without any callback
inport = mido.open_input()
# This... | diff --git a/mido/ports.py b/mido/ports.py
index 5b7b2b8..d32a3f4 100644
--- b/mido/ports.py
+++ a/mido/ports.py
@@ -167,7 +167,7 @@ class BaseInput(BasePort):
self._messages = self._parser.messages # Shortcut.
def _check_callback(self):
- if hasattr(self, 'callback') or self.callback is None:
+... |
Command line parsing broken for options with resilient parsing enabled
#### Description
When resilient parsing is enabled on a Click context, command line options are not being processed correctly. The parser appears to be returning empty results instead of parsing the provided arguments.
#### Steps/Code to Reproduc... | diff --git a/src/click/parser.py b/src/click/parser.py
index a8b7d26..de6df67 100644
--- b/src/click/parser.py
+++ a/src/click/parser.py
@@ -304,11 +304,11 @@ class _OptionParser:
"""
state = _ParsingState(args)
try:
+ self._process_args_for_options(state)
self._proces... |
SparseArray comparison operations broken after recent changes
#### Description
SparseArray comparison operations are failing with `UnboundLocalError` when performing comparisons between sparse arrays or with scalars. The error occurs because variables are being used before they are defined in the `_wrap_result` funct... | diff --git a/pandas/core/arrays/sparse/array.py b/pandas/core/arrays/sparse/array.py
index 137dbb6..08188c0 100644
--- b/pandas/core/arrays/sparse/array.py
+++ a/pandas/core/arrays/sparse/array.py
@@ -265,24 +265,25 @@ def _sparse_array_op(
def _wrap_result(
name: str, data, sparse_index, fill_value, dtype: Dtype... |
Factory function ignores custom Arrow type parameter
#### Description
The `arrow.api.factory()` function is not properly using the custom Arrow type parameter that's passed to it. When creating a factory with a custom Arrow class, the returned factory still creates instances of the default Arrow class instead of the ... | diff --git a/arrow/api.py b/arrow/api.py
index d8ed24b..957c9ab 100644
--- b/arrow/api.py
+++ a/arrow/api.py
@@ -120,7 +120,7 @@ def factory(type: Type[Arrow]) -> ArrowFactory:
"""
- return ArrowFactory() # misplaced type argument intentionally omitted
+ return ArrowFactory(type)
__all__ = ["get", ... |
support block type strings in resnet
**Is your feature request related to a problem? Please describe.**
from https://github.com/Project-MONAI/MONAI/discussions/4678, the resnet input args should be able to understand strings in addition to the class types, the corresponding docstrings should be revised https://github.... | diff --git a/monai/networks/nets/resnet.py b/monai/networks/nets/resnet.py
index d627224..e3ce66b 100644
--- b/monai/networks/nets/resnet.py
+++ a/monai/networks/nets/resnet.py
@@ -192,6 +192,9 @@ class ResNet(nn.Module):
Args:
block: which ResNet block to use, either Basic or Bottleneck.
+ R... |
AlignedIndentFilter returns wrong tuple order causing AttributeError
#### Description
The AlignedIndentFilter's `_next_token` method returns tuple elements in wrong order, causing AttributeError when trying to access token attributes.
#### Steps/Code to Reproduce
```python
import sqlparse
sql = """
select a, b as ... | diff --git a/sqlparse/filters/aligned_indent.py b/sqlparse/filters/aligned_indent.py
index dc60926..d7402d5 100644
--- b/sqlparse/filters/aligned_indent.py
+++ a/sqlparse/filters/aligned_indent.py
@@ -90,11 +90,11 @@ class AlignedIndentFilter:
split_words = T.Keyword, self.split_words, True
tidx, toke... |
SimpleTZ timezone parsing fails with UnboundLocalError for positive offsets
#### Description
When parsing timezone strings with positive offsets (like "+01:00"), the SimpleTZ class raises an UnboundLocalError because the `mult` variable is not defined in the positive offset case.
#### Steps/Code to Reproduce
```pyt... | diff --git a/gpxpy/gpxfield.py b/gpxpy/gpxfield.py
index e253df3..cfb04a8 100644
--- b/gpxpy/gpxfield.py
+++ a/gpxpy/gpxfield.py
@@ -46,12 +46,14 @@ class SimpleTZ(mod_datetime.tzinfo):
else:
if s[0] == '+':
s = s[1:]
+ mult = 1
hour = int(s... |
Progress bar stats display swapped rate and unit values
#### Description
The progress bar completion stats are displaying the rate and unit values in the wrong order. When a progress bar finishes, the final statistics show the unit where the rate should be and the rate where the unit should be.
#### Steps/Code to Re... | diff --git a/alive_progress/core/configuration.py b/alive_progress/core/configuration.py
index b36d671..e690926 100644
--- b/alive_progress/core/configuration.py
+++ a/alive_progress/core/configuration.py
@@ -47,10 +47,10 @@ def __func_lookup(module_lookup, inner_name):
def _input(x):
if isinstance(x, Fun... |
Depth limit validation ignores all fields when no ignore rules specified
#### Description
When using the depth limit validator without specifying any ignore rules, all fields are being ignored instead of none. This causes the depth calculation to return 0 for all queries, effectively disabling depth limiting.
#### S... | diff --git a/graphene/validation/depth_limit.py b/graphene/validation/depth_limit.py
index e0f2866..5a33bab 100644
--- b/graphene/validation/depth_limit.py
+++ a/graphene/validation/depth_limit.py
@@ -178,18 +178,18 @@ def determine_depth(
def is_ignored(node: FieldNode, ignore: Optional[List[IgnoreType]] = None) ->... |
### Issue with JsonFormatter: Log Record Serialization Fails
#### Description
I've encountered an issue with the `JsonFormatter` class in the `pythonjsonlogger` module. After a recent update, it seems that the log record serialization is not functioning as expected. The formatter is not correctly handling various log... | diff --git a/src/pythonjsonlogger/jsonlogger.py b/src/pythonjsonlogger/jsonlogger.py
index 519a64d..d9ab03e 100644
--- b/src/pythonjsonlogger/jsonlogger.py
+++ a/src/pythonjsonlogger/jsonlogger.py
@@ -255,26 +255,31 @@ class JsonFormatter(logging.Formatter):
def format(self, record: logging.LogRecord) -> str:
... |
# Missing information in `_print_message` function
### Problem
I noticed that when using the `cantools list` command, the output is missing important information about messages and signals that was previously displayed. The command is now showing a simplified output that lacks details like:
- Frame ID is shown incor... | diff --git a/src/cantools/subparsers/list.py b/src/cantools/subparsers/list.py
index ff09869..bb59bb9 100644
--- b/src/cantools/subparsers/list.py
+++ a/src/cantools/subparsers/list.py
@@ -29,100 +29,161 @@ def _format_val(val: Union[float, int, str, NamedSignalValue, None],
return f'{val:{value_format_specifier}}... |
ContainsCriterion generates incorrect SQL with swapped term and container
#### Description
When using the `isin` method or `IN` operations, the generated SQL has the term and container positions swapped, resulting in invalid queries.
#### Steps/Code to Reproduce
```python
from pypika import Query, Field
# Simple f... | diff --git a/pypika/terms.py b/pypika/terms.py
index a277e1a..2df0c79 100644
--- b/pypika/terms.py
+++ a/pypika/terms.py
@@ -931,11 +931,11 @@ class ContainsCriterion(Criterion):
def get_sql(self, subquery: Any = None, **kwargs: Any) -> str:
sql = "{term} {not_}IN {container}".format(
- term=... |
Route param parsing fails with missing closing delimiter error
#### Description
When defining routes with parameters, the router incorrectly reports missing closing delimiter '}' for valid route patterns. This appears to affect basic route registration functionality.
#### Steps/Code to Reproduce
```go
package main
... | diff --git a/tree.go b/tree.go
index 85fcfdb..11b1995 100644
--- b/tree.go
+++ a/tree.go
@@ -695,7 +695,7 @@ func patNextSegment(pattern string) (nodeTyp, string, string, byte, int, int) {
}
// Sanity check
- if ps >= 0 && ws >= 0 && ws <= ps {
+ if ps >= 0 && ws >= 0 && ws < ps {
panic("chi: wildcard '*' must... |
`dvc exp show --keep` option not working properly
#### Description
When using the `--keep` option with `dvc exp show`, the filtering functionality appears to be broken. The `--keep` parameter should protect columns matching the specified regex pattern from being dropped, but it's not working as expected.
#### Steps/... | diff --git a/dvc/commands/experiments/show.py b/dvc/commands/experiments/show.py
index 8f33708..f01eb70 100644
--- b/dvc/commands/experiments/show.py
+++ a/dvc/commands/experiments/show.py
@@ -67,7 +67,13 @@ def show_experiments(
**kwargs,
):
if keep:
- pass
+ for col in td.keys(): # noqa: SIM... |
Exception formatting broken for dev commands
When using dev commands that execute code snippets, the exception formatting is completely broken. Line numbers in tracebacks are wrong and syntax error messages don't show the actual code lines.
#### Steps to Reproduce
Try running any code that produces an exception thro... | diff --git a/redbot/core/dev_commands.py b/redbot/core/dev_commands.py
index b0deb5c..0dbd3ac 100644
--- b/redbot/core/dev_commands.py
+++ a/redbot/core/dev_commands.py
@@ -299,14 +299,29 @@ class DevOutput:
return async_compile(self.compilable_source, self.filename, "eval")
def format_exception(self, e... |
# Synthesizer's input predictor incorrectly uses dspy.Predict instead of dspy.ChainOfThought
## Description
The Synthesizer class in the experimental synthesizer module has a bug in the `_prepare_synthetic_data_predictors` method. The method is supposed to return a tuple of predictors for generating synthetic data, b... | diff --git a/dspy/experimental/synthesizer/synthesizer.py b/dspy/experimental/synthesizer/synthesizer.py
index e1184c5..b382ec5 100644
--- b/dspy/experimental/synthesizer/synthesizer.py
+++ a/dspy/experimental/synthesizer/synthesizer.py
@@ -83,59 +83,61 @@ class Synthesizer:
return field_name, field_desc... |
AuthorizationEndpoint create_authorization_response fails with NameError
#### Description
When calling `create_authorization_response` on an `AuthorizationEndpoint`, the method fails with a `NameError` because it tries to access the `request` variable before it's defined.
#### Steps/Code to Reproduce
```python
from... | diff --git a/oauthlib/oauth2/rfc6749/endpoints/authorization.py b/oauthlib/oauth2/rfc6749/endpoints/authorization.py
index 7196786..43f4c5d 100644
--- b/oauthlib/oauth2/rfc6749/endpoints/authorization.py
+++ a/oauthlib/oauth2/rfc6749/endpoints/authorization.py
@@ -72,7 +72,7 @@ class AuthorizationEndpoint(BaseEndpoint)... |
WordPress import command fails with NameError on missing variables
#### Description
The WordPress import command is broken and throws NameError exceptions when trying to access several variables that were accidentally removed during code cleanup.
#### Steps/Code to Reproduce
```python
from nikola.plugins.command.im... | diff --git a/nikola/plugins/command/import_wordpress.py b/nikola/plugins/command/import_wordpress.py
index 9a8b130..567958c 100644
--- b/nikola/plugins/command/import_wordpress.py
+++ a/nikola/plugins/command/import_wordpress.py
@@ -285,23 +285,35 @@ to
self.wordpress_export_file = options['filename']
... |
CLI diff command crashes with NameError when DeepDiff initialization fails
#### Description
The CLI diff command is crashing with a `NameError: name 'diff' is not defined` when there are issues during DeepDiff initialization. This happens because the `diff` variable is referenced before being defined when the DeepDif... | diff --git a/deepdiff/commands.py b/deepdiff/commands.py
index e878bf2..3aadb69 100644
--- b/deepdiff/commands.py
+++ a/deepdiff/commands.py
@@ -94,6 +94,11 @@ def diff(
# Disabling logging progress since it will leak into stdout
kwargs['log_frequency_in_sec'] = 0
+ try:
+ diff = DeepDiff(... |
JoinUsing fields order reversed and constructor arguments swapped
#### Description
When using `JOIN ... USING` with multiple fields, the field order gets reversed in the generated SQL. Additionally, there seems to be an issue with the constructor argument order.
#### Steps/Code to Reproduce
```python
from pypika im... | diff --git a/pypika/queries.py b/pypika/queries.py
index 42c7c45..d71541f 100644
--- b/pypika/queries.py
+++ a/pypika/queries.py
@@ -1734,8 +1734,8 @@ class JoinOn(Join):
class JoinUsing(Join):
def __init__(self, item: Term, how: JoinType, fields: Sequence[Field]) -> None:
- super().__init__(how, item)
-... |
Console script broken after recent changes
#### Description
The qrcode console script is completely broken and throws various errors when trying to generate QR codes. Multiple functions seem to have issues with undefined variables and incorrect module imports.
#### Steps/Code to Reproduce
```bash
# Basic usage fail... | diff --git a/qrcode/console_scripts.py b/qrcode/console_scripts.py
index 124265a..0d562da 100755
--- b/qrcode/console_scripts.py
+++ a/qrcode/console_scripts.py
@@ -41,7 +41,7 @@ error_correction = {
def main(args=None):
if args is None:
- pass
+ args = sys.argv[1:]
version = metadata.versi... |
Part constructor arguments swapped causing TypeError
When creating Part instances, the constructor arguments appear to be in the wrong order, causing a TypeError when trying to access the content_type property.
#### Steps/Code to Reproduce
```python
from docx.opc.part import Part
from docx.opc.packuri import PackURI... | diff --git a/src/docx/opc/part.py b/src/docx/opc/part.py
index cbb4ab5..8738630 100644
--- b/src/docx/opc/part.py
+++ a/src/docx/opc/part.py
@@ -70,7 +70,7 @@ class Part:
@property
def content_type(self):
"""Content type of this part."""
- return self._content_type.lower() + "; charset=utf-8"
... |
### Bug: UnboundLocalError in `chunked_upload_init` with MP4 media upload
#### Description
When attempting to upload an MP4 file using the `media_upload` method, an `UnboundLocalError` is raised. This error occurs when the `chunked_upload_init` function is called with an MP4 file, causing the upload process to fail.
... | diff --git a/tweepy/api.py b/tweepy/api.py
index 37caf07..269caf2 100644
--- b/tweepy/api.py
+++ a/tweepy/api.py
@@ -3685,8 +3685,6 @@ class API:
def chunked_upload_init(self, total_bytes, media_type, *,
media_category=None, additional_owners=None,
**kwargs... |
Frequency coercion broken for time-based frequencies
#### Description
When working with time-based frequencies like "h", "min", "s", "ms", "us", "ns", the frequency coercion logic is not working correctly. These frequencies should remain lowercase but are being converted to uppercase unexpectedly.
#### Steps/Code to... | diff --git a/pandas/tseries/frequencies.py b/pandas/tseries/frequencies.py
index 88ea1bf..79ba77f 100644
--- b/pandas/tseries/frequencies.py
+++ a/pandas/tseries/frequencies.py
@@ -569,9 +569,10 @@ def _maybe_coerce_freq(code) -> str:
if isinstance(code, DateOffset):
code = PeriodDtype(to_offset(code.name... |
Async for loops iterate in reverse order
#### Description
When using async for loops in Jinja2 templates, the iteration order is reversed compared to regular for loops. This affects all async loop functionality including loop variables like `loop.previtem`, `loop.nextitem`, and recursive loops.
#### Steps/Code to Re... | diff --git a/src/jinja2/runtime.py b/src/jinja2/runtime.py
index 9dcc9d4..1541f48 100644
--- b/src/jinja2/runtime.py
+++ a/src/jinja2/runtime.py
@@ -593,8 +593,6 @@ class AsyncLoopContext(LoopContext):
def _to_iterator( # type: ignore
iterable: t.Union[t.Iterable[V], t.AsyncIterable[V]],
) -> t.Asyn... |
FPS calibration returns incorrect values for negative rates and edge cases
#### Description
The FPS calibration function is returning unexpected values when dealing with negative rates and certain edge cases. For negative rates, it should return a bootstrap speed of 10.0, but it's returning 0.0 instead. Additionally,... | diff --git a/alive_progress/core/calibration.py b/alive_progress/core/calibration.py
index c587d5f..b159017 100644
--- b/alive_progress/core/calibration.py
+++ a/alive_progress/core/calibration.py
@@ -23,16 +23,16 @@ def calibrated_fps(calibrate):
"""
min_fps, max_fps = 2., 60.
- calibrate = min(1e-6, ca... |
Stata file timestamp generation broken for version 117+
#### Description
When writing Stata files with version 117 or higher, the timestamp in the file header is malformed. The month name is missing from the timestamp string, causing issues when the file is read back or opened in Stata.
#### Steps/Code to Reproduce
... | diff --git a/pandas/io/stata.py b/pandas/io/stata.py
index 34d95fb..2afb4bf 100644
--- b/pandas/io/stata.py
+++ a/pandas/io/stata.py
@@ -3463,12 +3463,14 @@ class StataWriter117(StataWriter):
month_lookup = {i + 1: month for i, month in enumerate(months)}
ts = (
time_stamp.strftime("%d ")... |
### Issue: TypeError in For Loop Parsing
#### Description
After the recent changes, there seems to be an issue with parsing `for` loops in templates. The `For` node is not being constructed correctly, leading to a `TypeError` when attempting to render templates that include `for` loops. This error occurs across vario... | diff --git a/src/jinja2/parser.py b/src/jinja2/parser.py
index 817abec..0143201 100644
--- b/src/jinja2/parser.py
+++ a/src/jinja2/parser.py
@@ -235,29 +235,23 @@ class Parser:
def parse_for(self) -> nodes.For:
"""Parse a for loop."""
- lineno = next(self.stream).lineno
- target = self.par... |
# Environment variables and worker initialization issues
I've encountered a problem with the worker initialization process in Gunicorn. When running my application, I'm seeing unexpected behavior related to environment variables and worker reloading.
## Description
When a worker initializes, it seems that environmen... | diff --git a/gunicorn/workers/base.py b/gunicorn/workers/base.py
index 93c465c..650b8ca 100644
--- b/gunicorn/workers/base.py
+++ a/gunicorn/workers/base.py
@@ -92,11 +92,11 @@ class Worker:
# set environment' variables
if self.cfg.env:
- for v, k in self.cfg.env.items():
+ for... |
Syntax error column position off by one
When a CSS selector has a syntax error, the column position reported in the error context is off by one. The error pointer appears one position to the left of where it should be.
#### Steps/Code to Reproduce
```python
import soupsieve as sv
try:
sv.compile('input.field[ty... | diff --git a/soupsieve/util.py b/soupsieve/util.py
index 9b2e64d..b4fe04e 100644
--- b/soupsieve/util.py
+++ a/soupsieve/util.py
@@ -92,11 +92,11 @@ def get_pattern_context(pattern: str, index: int) -> tuple[str, int, int]:
if not len(m.group(0)) and not len(text):
indent = ''
offset ... |
ClassDef._inferred_bases() returns incorrect object reference causing KeyError
#### Description
When working with class inheritance, the `_inferred_bases()` method in `ClassDef` is returning an incorrect object reference, which causes a `KeyError: 0` when trying to access builtin objects or process class hierarchies.... | diff --git a/astroid/nodes/scoped_nodes/scoped_nodes.py b/astroid/nodes/scoped_nodes/scoped_nodes.py
index 99ed796..51459af 100644
--- b/astroid/nodes/scoped_nodes/scoped_nodes.py
+++ a/astroid/nodes/scoped_nodes/scoped_nodes.py
@@ -2801,18 +2801,30 @@ class ClassDef(
return self._all_slots
def _inferre... |
# Settings.__getattr__ logic is reversed, causing AttributeError for valid settings
## Description
I discovered a bug in the `Settings.__getattr__` method where the logic for checking attributes is reversed. When trying to access a valid setting that exists in `main_thread_config`, the code raises an `AttributeError`... | diff --git a/dspy/dsp/utils/settings.py b/dspy/dsp/utils/settings.py
index 983927f..36828c9 100644
--- b/dspy/dsp/utils/settings.py
+++ a/dspy/dsp/utils/settings.py
@@ -76,9 +76,10 @@ class Settings:
if name in overrides:
return overrides[name]
elif name in main_thread_config:
+ ... |
get_latest_suite_node returns wrong node type
#### Description
The `get_latest_suite_node` method in `IndentationNode` is returning nodes that are not suite nodes. This affects PEP8 normalization and indentation handling.
#### Steps/Code to Reproduce
```python
import parso
code = """
def foo():
if True:
... | diff --git a/parso/python/pep8.py b/parso/python/pep8.py
index c492dae..a64b18c 100644
--- b/parso/python/pep8.py
+++ a/parso/python/pep8.py
@@ -47,7 +47,7 @@ class IndentationNode(object):
def get_latest_suite_node(self):
n = self
while n is not None:
- if n.type != IndentationTypes.S... |
submap method raises UnboundLocalError when accessing pixel_corners variable
#### Description
The `submap` method in `GenericMap` is raising an `UnboundLocalError` when trying to access the `pixel_corners` variable. This appears to be happening because the variable is being used before it's defined in the method.
##... | diff --git a/sunpy/map/mapbase.py b/sunpy/map/mapbase.py
index bdcac77..4711a9d 100644
--- b/sunpy/map/mapbase.py
+++ a/sunpy/map/mapbase.py
@@ -1957,60 +1957,6 @@ class GenericMap(NDData):
@u.quantity_input
def submap(self, bottom_left, *, top_right=None, width: (u.deg, u.pix) = None, height: (u.deg, u.pix... |
StringArray.isin() fails with BaseStringArray values parameter
#### Description
When calling `isin()` on a StringArray with another BaseStringArray as the values parameter, the method raises an AttributeError because it tries to call `_from_sequence` on the wrong branch of the conditional logic.
#### Steps/Code to R... | diff --git a/pandas/core/arrays/string_.py b/pandas/core/arrays/string_.py
index 7227ea7..3124434 100644
--- b/pandas/core/arrays/string_.py
+++ a/pandas/core/arrays/string_.py
@@ -801,6 +801,8 @@ class StringArray(BaseStringArray, NumpyExtensionArray): # type: ignore[misc]
if isinstance(values, BaseStringArr... |
#### Description
The `widow_control` property in `ParagraphFormat` returns incorrect boolean values when the paragraph properties element is missing or when widow control is enabled.
#### Steps/Code to Reproduce
```python
from docx import Document
from docx.shared import Inches
# Create a new document
doc = Documen... | diff --git a/src/docx/text/parfmt.py b/src/docx/text/parfmt.py
index ea37437..dfba21a 100644
--- b/src/docx/text/parfmt.py
+++ a/src/docx/text/parfmt.py
@@ -246,8 +246,8 @@ class ParagraphFormat(ElementProxy):
"""
pPr = self._element.pPr
if pPr is None:
- return False
- retu... |
KCD multiplex signal loading broken with argument order error
#### Description
When loading KCD files with multiplex signals, the parser fails with `'list' object has no attribute 'attrib'` error. This appears to be related to incorrect argument ordering in the `_load_signal_element` function calls within the multipl... | diff --git a/src/cantools/database/can/formats/kcd.py b/src/cantools/database/can/formats/kcd.py
index a54c86c..d969d1b 100644
--- b/src/cantools/database/can/formats/kcd.py
+++ a/src/cantools/database/can/formats/kcd.py
@@ -151,18 +151,18 @@ def _load_multiplex_element(mux, nodes):
"""
- mux_signal = _load... |
SQL Builder not properly handling PlanOptions in Build method
#### Description
The `Build` method in the postgres migrate state is not using the configured `PlanOptions` when creating SQL builders, causing SQL statements to be generated without proper formatting or configuration options.
#### Steps/Code to Reproduce... | diff --git a/sql/postgres/migrate_oss.go b/sql/postgres/migrate_oss.go
index 2b3756b..567784e 100644
--- b/sql/postgres/migrate_oss.go
+++ a/sql/postgres/migrate_oss.go
@@ -1199,14 +1199,8 @@ func (s *state) append(c ...*migrate.Change) {
// Build instantiates a new builder and writes the given phrase to it.
func (... |
MoneyField value gets doubled and validation fails with wrong object
#### Description
When working with MoneyField instances, the field value gets unexpectedly doubled and validation is performed on the wrong object, causing various operations to fail.
#### Steps/Code to Reproduce
```python
from djmoney import Mone... | diff --git a/djmoney/models/fields.py b/djmoney/models/fields.py
index dc5f6ad..8052852 100644
--- b/djmoney/models/fields.py
+++ a/djmoney/models/fields.py
@@ -125,11 +125,11 @@ class MoneyFieldProxy:
obj.__dict__[self.field.name] = value
def prepare_value(self, obj, value):
- validate_money_val... |
DataFrame merge produces incorrect column order when using cross merge
#### Description
When performing a cross merge operation on DataFrames, the resulting DataFrame has columns in the wrong order. The left DataFrame columns should appear before the right DataFrame columns, but they appear after instead.
#### Steps... | diff --git a/pandas/core/reshape/merge.py b/pandas/core/reshape/merge.py
index 09be82c..6929b4a 100644
--- b/pandas/core/reshape/merge.py
+++ a/pandas/core/reshape/merge.py
@@ -1083,49 +1083,50 @@ class _MergeOperation:
"""
reindex along index and concat along columns.
"""
+ # Take vie... |
LazyFile.close() doesn't actually close the file
#### Description
The `LazyFile.close()` method only flushes the underlying file instead of actually closing it. This causes issues when the file handle remains open after calling close().
#### Steps/Code to Reproduce
```python
import click
import tempfile
import os
... | diff --git a/src/click/utils.py b/src/click/utils.py
index ab2fe58..2894091 100644
--- b/src/click/utils.py
+++ a/src/click/utils.py
@@ -169,7 +169,7 @@ class LazyFile:
def close(self) -> None:
"""Closes the underlying file, no matter what."""
if self._f is not None:
- self._f.flush()
... |
PDFStandardSecurityHandler initialization order causes AttributeError
#### Description
When processing encrypted PDF files, the PDFStandardSecurityHandler fails during initialization with an AttributeError. The issue occurs because `init_key()` is being called before the required parameters are properly initialized.
... | diff --git a/pdfminer/pdfdocument.py b/pdfminer/pdfdocument.py
index 1c06335..50dee58 100644
--- b/pdfminer/pdfdocument.py
+++ a/pdfminer/pdfdocument.py
@@ -345,11 +345,12 @@ class PDFStandardSecurityHandler:
self.init()
def init(self) -> None:
- self.init_key()
self.init_params()
... |
UnboundLocalError in pandas utility functions after recent changes
#### Description
Several pandas utility functions are throwing `UnboundLocalError` exceptions when called. This affects functions like `show_versions()`, argument validation functions, and boolean validation utilities.
#### Steps/Code to Reproduce
`... | diff --git a/pandas/util/_print_versions.py b/pandas/util/_print_versions.py
index bd20660..034ba1d 100644
--- b/pandas/util/_print_versions.py
+++ a/pandas/util/_print_versions.py
@@ -63,7 +63,6 @@ def _get_dependency_info() -> dict[str, JSONSerializable]:
"""
Returns dependency information as a JSON seriali... |
FileResponse fails when serving files without range requests
#### Description
After a recent change, FileResponse is broken for basic file serving without range requests. The `_handle_simple` method was removed but it's still being called internally, causing an AttributeError.
#### Steps/Code to Reproduce
```python... | diff --git a/starlette/responses.py b/starlette/responses.py
index c711dfa..1c2db22 100644
--- b/starlette/responses.py
+++ a/starlette/responses.py
@@ -373,6 +373,18 @@ class FileResponse(Response):
if self.background is not None:
await self.background()
+ async def _handle_simple(self, send... |
# Incorrect type identification in cc_to_dict function
## Description
The `cc_to_dict` function in `radon/cli/tools.py` is incorrectly identifying the type of objects. The function is supposed to determine whether an object is a method, function, or class, but it's currently returning the wrong types.
When using the... | diff --git a/radon/cli/tools.py b/radon/cli/tools.py
index cc8d4fa..78163d9 100644
--- b/radon/cli/tools.py
+++ a/radon/cli/tools.py
@@ -297,8 +297,8 @@ def cc_to_dict(obj):
def get_type(obj):
'''The object can be of type *method*, *function* or *class*.'''
if isinstance(obj, Function):
- ... |
### Issue with HTTP Error Handling in Scraper
#### What happened?
While using the `Scraper` class to fetch files from a web directory, it seems that certain HTTP errors are not being handled as expected. Specifically, when encountering HTTP errors such as 400 (Bad Request), 403 (Forbidden), 429 (Too Many Requests), a... | diff --git a/sunpy/net/scraper.py b/sunpy/net/scraper.py
index 202638e..3cd10bd 100644
--- b/sunpy/net/scraper.py
+++ a/sunpy/net/scraper.py
@@ -344,43 +344,60 @@ class Scraper:
Goes over http archives hosted on the web, to return list of files in the given timerange.
"""
directories = self.r... |
Style formatting produces incorrect output after recent changes
#### Description
The style formatting system is producing incorrect output when highlighting code. Colors and formatting attributes appear to be mixed up or applied incorrectly.
#### Steps/Code to Reproduce
```python
from pygments import highlight
from... | diff --git a/pygments/style.py b/pygments/style.py
index 449522c..61452e1 100644
--- b/pygments/style.py
+++ a/pygments/style.py
@@ -61,19 +61,19 @@ class StyleMeta(type):
obj = type.__new__(mcs, name, bases, dct)
for token in STANDARD_TYPES:
if token not in obj.styles:
- o... |
Index.insert() fails with ExtensionArray when trying to insert incompatible types
#### Description
When using `Index.insert()` with an ExtensionArray-backed index and trying to insert an item that's incompatible with the array's dtype, the operation fails instead of falling back to a compatible dtype.
#### Steps/Cod... | diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py
index c17c8c1..c15a5f3 100644
--- b/pandas/core/indexes/base.py
+++ a/pandas/core/indexes/base.py
@@ -6917,6 +6917,22 @@ class Index(IndexOpsMixin, PandasObject):
if dtype != self.dtype:
return self.astype(dtype).insert... |
Font processing fails with UnboundLocalError when colorspace spec is a list
#### Description
When processing PDF files that contain colorspace specifications as lists, the PDF interpreter fails with an `UnboundLocalError: local variable 'name' referenced before assignment`. This occurs because the `get_colorspace` fu... | diff --git a/pdfminer/pdfinterp.py b/pdfminer/pdfinterp.py
index ae1c46a..effe89b 100644
--- b/pdfminer/pdfinterp.py
+++ a/pdfminer/pdfinterp.py
@@ -382,7 +382,7 @@ class PDFPageInterpreter:
def get_colorspace(spec: object) -> Optional[PDFColorSpace]:
if isinstance(spec, list):
- ... |
IOLoop.initialized() method missing causing AttributeError in fork_processes
#### Description
When calling `fork_processes()`, the code fails with an AttributeError because `IOLoop.initialized()` method doesn't exist. The error message suggests using `initialize` instead, but this breaks the multiprocess functionalit... | diff --git a/tornado/process.py b/tornado/process.py
index 339ef65..8d31712 100644
--- b/tornado/process.py
+++ a/tornado/process.py
@@ -80,8 +80,9 @@ def _reseed_random() -> None:
_task_id = None
-def fork_processes(num_processes: Optional[int], max_restarts: Optional[int
- ]=None) ->int:
+def fork_processes(
... |
CallContext arguments and keywords incorrectly processed
#### Description
When creating a CallContext, the positional arguments are being reversed and keyword argument pairs are swapped, causing incorrect function call analysis.
#### Steps/Code to Reproduce
```python
import astroid
# Create a simple function call
... | diff --git a/astroid/context.py b/astroid/context.py
index d5efc9a..c663034 100644
--- b/astroid/context.py
+++ a/astroid/context.py
@@ -172,13 +172,13 @@ class CallContext:
keywords: list[Keyword] | None = None,
callee: InferenceResult | None = None,
):
- self.args = list(reversed(args)) ... |
### Issue with `readlink` Returning Bytes Instead of String
#### Describe the bug
The `readlink` method in the SFTP client is returning a byte string instead of a regular string. This behavior is causing issues when comparing the result of `readlink` with expected string values.
#### How to Reproduce
1. Create a sy... | diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py
index 066cd83..6fa9bbf 100644
--- b/paramiko/sftp_client.py
+++ a/paramiko/sftp_client.py
@@ -609,9 +609,12 @@ class SFTPClient(BaseSFTP, ClosingContextManager):
if t != CMD_NAME:
raise SFTPError("Expected name response")
coun... |
HECClient initialization fails with UnboundLocalError when SSL error occurs
#### Description
When creating a HECClient instance and an SSL error occurs during initialization, the code raises an `UnboundLocalError: cannot access local variable 'session' where it is not associated with a value` instead of properly hand... | diff --git a/sunpy/net/helio/hec.py b/sunpy/net/helio/hec.py
index 8b84536..cd0da7b 100644
--- b/sunpy/net/helio/hec.py
+++ a/sunpy/net/helio/hec.py
@@ -67,16 +67,6 @@ class HECClient(BaseClient):
"""
def __init__(self, link=None):
- transport = Transport(session=session)
- if link is None:
- ... |
Crash when analysing qiskit
**Crash Report**
Running mypy on a library where typing has recently been added causes a crash while analyzing this line:
https://github.com/Qiskit/qiskit-terra/blob/main/qiskit/circuit/library/blueprintcircuit.py#L72
**Traceback**
```
/q/qiskit-terra/qiskit/circuit/library/blue... | diff --git a/mypy/checker.py b/mypy/checker.py
index b8d5bbd..83c1baf 100644
--- b/mypy/checker.py
+++ a/mypy/checker.py
@@ -2148,7 +2148,7 @@ class TypeChecker(NodeVisitor[None], CheckerPluginInterface):
# `original_type` can be partial if (e.g.) it is originally an
# instance variable from an `__ini... |
File operations broken after recent changes
#### Description
File operations are failing with "File not open for writing" errors even when files are opened in write mode. This affects both SFTP operations and regular file handling.
#### Steps/Code to Reproduce
```python
import paramiko
# Basic file writing fails
w... | diff --git a/paramiko/file.py b/paramiko/file.py
index a36abb9..2c5e9a5 100644
--- b/paramiko/file.py
+++ a/paramiko/file.py
@@ -87,12 +87,12 @@ class BufferedFile(ClosingContextManager):
def flush(self):
"""
- Write out any data in the write buffer. This may do nothing if write
+ Write ou... |
# Bug in map_err method of Ok class
<!-- Summary. -->
I found a bug in the `map_err` method of the `Ok` class in the Result library. When trying to map errors, the method doesn't work correctly for successful results.
<!-- What you expected. -->
I expected the `map_err` method to return the original `Ok` value unch... | diff --git a/src/result/result.py b/src/result/result.py
index 8551239..d856270 100644
--- b/src/result/result.py
+++ a/src/result/result.py
@@ -180,7 +180,7 @@ class Ok(Generic[T]):
"""
The contained result is `Ok`, so return `Ok` with the original value
"""
- return op
+ retur... |
Graph initialization adds extra data point causing plot dimension mismatch
#### Description
When creating plots, the Graph class initialization is adding an unexpected data point that causes x and y arrays to have mismatched dimensions. This results in plotting errors when the data arrays don't align properly.
#### ... | diff --git a/src/cantools/subparsers/plot.py b/src/cantools/subparsers/plot.py
index c3d5890..380fc0f 100644
--- b/src/cantools/subparsers/plot.py
+++ a/src/cantools/subparsers/plot.py
@@ -795,9 +795,9 @@ class Graph:
__slots__ = ('plotted_signal', 'x', 'y')
def __init__(self):
- self.x = [0] # Chan... |
CSS selector matching broken for XML documents
#### Description
When parsing XML documents, CSS selectors are not matching elements correctly. The tag name matching appears to be completely broken, causing selectors to fail to find elements that should match.
#### Steps/Code to Reproduce
```python
import soupsieve ... | diff --git a/soupsieve/css_match.py b/soupsieve/css_match.py
index e52e42d..3f78cfa 100644
--- b/soupsieve/css_match.py
+++ a/soupsieve/css_match.py
@@ -548,7 +548,7 @@ class CSSMatch(_DocumentNav):
"""Get tag."""
name = self.get_tag_name(el)
- return util.upper(name) if name is not None and ... |
ArgReplacer logic inverted for positional vs keyword arguments
#### Description
The `ArgReplacer.replace()` method has inverted logic when determining whether an argument is passed positionally or by keyword. When an argument position exists and there are enough positional arguments, it should handle the positional c... | diff --git a/tornado/util.py b/tornado/util.py
index 2e5eee7..9e4caed 100644
--- b/tornado/util.py
+++ a/tornado/util.py
@@ -392,16 +392,17 @@ class ArgReplacer:
to ``kwargs`` and None will be returned as ``old_value``.
"""
if self.arg_pos is not None and len(args) > self.arg_pos:
- ... |
Dashboard._iter_panels() iterates over wrong collections
#### Description
The `_iter_panels()` method in the Dashboard class is iterating over the wrong collections. When trying to access panels from a dashboard, the method fails to properly iterate through both rows and panels.
#### Steps/Code to Reproduce
```pyth... | diff --git a/grafanalib/core.py b/grafanalib/core.py
index 79849fe..45b636b 100644
--- b/grafanalib/core.py
+++ a/grafanalib/core.py
@@ -1820,11 +1820,11 @@ class Dashboard(object):
uid = attr.ib(default=None)
def _iter_panels(self):
- for row in self.panels:
+ for row in self.rows:
... |
np.gradient returns all zeros when computing gradients
#### Description
When using autograd with `np.gradient`, the gradient computation returns an array of all zeros instead of the expected gradient values.
#### Steps/Code to Reproduce
```python
import autograd.numpy as np
from autograd import grad
# Simple 1D ca... | diff --git a/autograd/numpy/numpy_vjps.py b/autograd/numpy/numpy_vjps.py
index 08d4e1b..1fb50ab 100644
--- b/autograd/numpy/numpy_vjps.py
+++ a/autograd/numpy/numpy_vjps.py
@@ -313,10 +313,28 @@ def grad_gradient(ans, x, *vargs, **kwargs):
# accumulate gradient
out = anp.zeros(x_shape, dtype=x_dtype)
... |
Text extraction with layout produces IndexError when accessing empty textmap
When using `extract_text(layout=True)` on certain PDFs, the text extraction fails with an `IndexError: list index out of range` error. This appears to happen when the textmap becomes empty during processing.
#### Steps/Code to Reproduce
```... | diff --git a/pdfplumber/utils/text.py b/pdfplumber/utils/text.py
index 8edafa1..f649819 100644
--- b/pdfplumber/utils/text.py
+++ a/pdfplumber/utils/text.py
@@ -297,7 +297,7 @@ class WordMap:
if not len(self.tuples):
return TextMap(
_textmap,
- line_dir_render=line_... |
CharsetMatches.__len__ returns incorrect count
#### Description
The `CharsetMatches` class returns an incorrect length when calling `len()` on it. The length is off by one, returning one more than the actual number of results.
#### Steps/Code to Reproduce
```python
from charset_normalizer import from_bytes
# Test ... | diff --git a/charset_normalizer/models.py b/charset_normalizer/models.py
index 09492a9..b18cc51 100644
--- b/charset_normalizer/models.py
+++ a/charset_normalizer/models.py
@@ -268,7 +268,7 @@ class CharsetMatches:
raise KeyError
def __len__(self) -> int:
- return len(self._results) + 1
+ ... |
# ExceptionGroup.split() method returns incorrect results
### Description
I've discovered a bug in the `split()` method of `BaseExceptionGroup`. When trying to split an exception group based on a condition, the method is returning incorrect results - it seems to be mixing up the matching and non-matching exceptions.
... | diff --git a/src/exceptiongroup/_exceptions.py b/src/exceptiongroup/_exceptions.py
index a4a7ace..bf114d9 100644
--- b/src/exceptiongroup/_exceptions.py
+++ a/src/exceptiongroup/_exceptions.py
@@ -212,8 +212,8 @@ class BaseExceptionGroup(BaseException, Generic[_BaseExceptionT_co]):
]
):
condition... |
# Language detection fails after recent changes
## Description
I've discovered a critical issue with the language detection functionality. After some recent changes, the language detector is no longer correctly identifying languages.
## How to Reproduce
The following simple code fails to correctly identify language... | diff --git a/langdetect/utils/lang_profile.py b/langdetect/utils/lang_profile.py
index 118cff8..aeac463 100644
--- b/langdetect/utils/lang_profile.py
+++ a/langdetect/utils/lang_profile.py
@@ -27,13 +27,13 @@ class LangProfile(object):
def add(self, gram):
'''Add n-gram to profile.'''
- if gram i... |
Manpage update function not working correctly
I'm having issues with the manpage update functionality. When I try to update the manpage with version information, it's not behaving as expected.
#### Steps to Reproduce
```python
from qrcode.release import update_manpage
# This should update the manpage
update_manpage... | diff --git a/qrcode/release.py b/qrcode/release.py
index 208ac1e..fe56c0c 100644
--- b/qrcode/release.py
+++ a/qrcode/release.py
@@ -12,7 +12,7 @@ def update_manpage(data):
"""
Update the version in the manpage document.
"""
- if data["name"] == "qrcodes":
+ if data["name"] != "qrcode":
re... |
# Setting currency to None in MoneyFieldProxy.__set__ causes multiple issues
### Current problem
When setting a Money field value, the `__set__` method in `MoneyFieldProxy` has been rewritten and now has several issues:
1. It doesn't properly handle nullable currency fields when setting non-Money values
2. It fails ... | diff --git a/djmoney/models/fields.py b/djmoney/models/fields.py
index dc5f6ad..b780b47 100644
--- b/djmoney/models/fields.py
+++ a/djmoney/models/fields.py
@@ -105,34 +105,25 @@ class MoneyFieldProxy:
data[self.field.name] = self._money_from_obj(obj)
return data[self.field.name]
- def __set_... |
Non-FITS unit strings no longer trigger warnings
#### Description
When using unit strings that are not valid FITS units (like "Mx", "electron", or "DN / electron"), the Map class no longer emits warnings as expected. Previously, these invalid unit strings would trigger a `SunpyMetadataWarning` to inform users about t... | diff --git a/sunpy/map/mapbase.py b/sunpy/map/mapbase.py
index bdcac77..5914f8a 100644
--- b/sunpy/map/mapbase.py
+++ a/sunpy/map/mapbase.py
@@ -794,7 +794,27 @@ class GenericMap(NDData):
if unit_str.lower() in replacements:
unit_str = replacements[unit_str.lower()]
unit = u.Unit(unit_str... |
### Bug report
**Bug summary**
After the recent changes, certain client operations are not functioning as expected. Specifically, actions related to following/unfollowing lists and users, managing pinned lists, and interacting with tweets (like/unlike) are failing.
**Code for reproduction**
Here's a minimal example t... | diff --git a/tweepy/client.py b/tweepy/client.py
index d463129..3947a36 100644
--- b/tweepy/client.py
+++ a/tweepy/client.py
@@ -45,20 +45,20 @@ class BaseClient:
access_token=None, access_token_secret=None, *, return_type=Response,
wait_on_rate_limit=False
):
- self.bearer_token = consume... |
# Bug in random.sample inference in brain_random.py
I've found a bug in the inference of `random.sample` in the brain_random.py module. The issue affects how arguments are processed and how the function behaves when certain conditions are met.
## Issue Description
When using `random.sample` with a sequence and a len... | diff --git a/astroid/brain/brain_random.py b/astroid/brain/brain_random.py
index 48cc121..cd1d3dc 100644
--- b/astroid/brain/brain_random.py
+++ a/astroid/brain/brain_random.py
@@ -26,18 +26,11 @@ ACCEPTED_ITERABLES_FOR_SAMPLE = (List, Set, Tuple)
def _clone_node_with_lineno(node, parent, lineno):
- if hasattr(... |
Authorization code grant validation logic inverted causing authentication failures
#### Description
The authorization code grant validation is failing for valid requests and allowing invalid ones. When trying to authenticate with proper OAuth2 authorization code flow, the server returns errors for legitimate requests... | diff --git a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
index 09dc619..a77f210 100644
--- b/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
+++ a/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py
@@ -45,8 +45,8 @@ def code_chal... |
Delta subtraction operation produces incorrect results
#### Description
When using the subtraction operator (`-`) with Delta objects, the operation returns incorrect results. The subtraction should reverse the delta operation, but instead it appears to be returning the negation of an incorrect result.
#### Steps/Cod... | diff --git a/deepdiff/delta.py b/deepdiff/delta.py
index 8bafc9a..1c51f12 100644
--- b/deepdiff/delta.py
+++ a/deepdiff/delta.py
@@ -204,11 +204,11 @@ class Delta:
def __rsub__(self, other):
if self._reversed_diff is None:
- self._reversed_diff = self.diff
+ self._reversed_diff = s... |
Binary or union type operands are swapped
#### Description
When using the binary or operator (`|`) to create union types in Python 3.10+, the operands are being swapped in the resulting UnionType. The left operand becomes the right operand and vice versa.
#### Steps/Code to Reproduce
```python
import astroid
code ... | diff --git a/astroid/nodes/_base_nodes.py b/astroid/nodes/_base_nodes.py
index 65b703d..706b6fa 100644
--- b/astroid/nodes/_base_nodes.py
+++ a/astroid/nodes/_base_nodes.py
@@ -477,7 +477,7 @@ class OperatorNode(NodeNG):
right: bases.UnionType | nodes.ClassDef | nodes.Const,
) -> Generator[InferenceResult... |
Deprecation decorator not working for default argument values
#### Description
The deprecation decorator for default argument values is not functioning correctly. When calling methods or constructors that should trigger deprecation warnings for default argument values, no warnings are being emitted.
#### Steps/Code ... | diff --git a/astroid/decorators.py b/astroid/decorators.py
index cd0f5a7..6a81a7f 100644
--- b/astroid/decorators.py
+++ a/astroid/decorators.py
@@ -128,9 +128,11 @@ if util.check_warnings_filter(): # noqa: C901
@functools.wraps(func)
def wrapper(*args: _P.args, **kwargs: _P.kwargs) -> _R:
... |
Environment Variable Impact on Config Evaluation
Description
It seems that recent changes to the environment variable handling have introduced unexpected behavior in the configuration evaluation process. Specifically, the use of environment variables like `MONAI_EVAL_EXPR` and `MONAI_ALLOW_MISSING_REFERENCE` is affec... | diff --git a/monai/bundle/config_item.py b/monai/bundle/config_item.py
index e5122bf..4b1d739 100644
--- b/monai/bundle/config_item.py
+++ a/monai/bundle/config_item.py
@@ -13,7 +13,6 @@ from __future__ import annotations
import ast
import inspect
-import os
import sys
import warnings
from abc import ABC, abstra... |
### Issue: Column Qualification and Annotation Errors
#### Description
After the recent changes, there seems to be an issue with how columns are being qualified and annotated, particularly when dealing with lateral views and unnest operations. The optimizer is not correctly resolving column types, leading to unexpect... | diff --git a/sqlglot/optimizer/qualify_columns.py b/sqlglot/optimizer/qualify_columns.py
index 3ab987d..a22bc8f 100644
--- b/sqlglot/optimizer/qualify_columns.py
+++ a/sqlglot/optimizer/qualify_columns.py
@@ -893,56 +893,52 @@ class Resolver:
}
return self._all_columns
- def get_source_column... |
JSOCClient.fetch() raises UnboundLocalError when processing empty responses
#### Description
When calling `fetch()` on an empty JSOC response, the method raises an `UnboundLocalError` because it tries to access a local variable `responses` that hasn't been defined yet.
#### Steps/Code to Reproduce
```python
from su... | diff --git a/sunpy/net/jsoc/jsoc.py b/sunpy/net/jsoc/jsoc.py
index f5506de..e563701 100644
--- b/sunpy/net/jsoc/jsoc.py
+++ a/sunpy/net/jsoc/jsoc.py
@@ -371,38 +371,6 @@ class JSOCClient(BaseClient):
@convert_row_to_table
def fetch(self, jsoc_response, path=None, progress=True, overwrite=False,
... |
Math plugin renders inline and block math incorrectly
#### Description
The math plugin is not rendering inline and block math expressions correctly. Block math expressions are being rendered with inline math formatting, and inline math expressions are being rendered with block math formatting.
#### Steps/Code to Rep... | diff --git a/src/mistune/plugins/math.py b/src/mistune/plugins/math.py
index 30eb349..af3f46b 100644
--- b/src/mistune/plugins/math.py
+++ a/src/mistune/plugins/math.py
@@ -27,7 +27,7 @@ def parse_inline_math(
def render_block_math(renderer: "BaseRenderer", text: str) -> str:
- return '<div class="math">\n' + t... |
PackageLoader.list_templates() returns incorrect path separators and sorting
#### Description
The `PackageLoader.list_templates()` method is returning template paths with incorrect path separators and wrong sorting order. Instead of using forward slashes as path separators (which is the expected format for template p... | diff --git a/src/jinja2/loaders.py b/src/jinja2/loaders.py
index 8ca32cb..fea4d5c 100644
--- b/src/jinja2/loaders.py
+++ a/src/jinja2/loaders.py
@@ -396,25 +396,28 @@ class PackageLoader(BaseLoader):
results: t.List[str] = []
if self._archive is None:
+ # Package is a directory.
... |
Task list items not rendering correctly
Description
It seems that the task list items are not rendering as expected after the recent changes. The checkboxes are not appearing correctly in the HTML output. This issue can be reproduced by using the `render_task_list_item` function to generate a task list item.
For ex... | diff --git a/src/mistune/plugins/task_lists.py b/src/mistune/plugins/task_lists.py
index 840088f..53c1bf7 100644
--- b/src/mistune/plugins/task_lists.py
+++ a/src/mistune/plugins/task_lists.py
@@ -15,20 +15,22 @@ def task_lists_hook(md: "Markdown", state: "BlockState") -> Iterable[Dict[str, A
return _rewrite_all_l... |
BitString.fromHexString returns raw input instead of processed value
#### Description
When calling `BitString.fromHexString()`, the method returns the raw input string instead of the properly processed BitString value. This affects all BitString operations that rely on hex string conversion.
#### Steps/Code to Repro... | diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py
index 9aff5e6..79503c2 100644
--- b/pyasn1/type/univ.py
+++ a/pyasn1/type/univ.py
@@ -569,11 +569,6 @@ class BitString(base.SimpleAsn1Type):
value: :class:`str`
Text string like 'DEADBEEF'
"""
-
- return value
-
- if not... |
Presentation properties returning wrong values
I'm having issues with the Presentation class where some properties are returning incorrect values or behaving unexpectedly.
#### Steps/Code to Reproduce
```python
from pptx import Presentation
# Create or load a presentation
prs = Presentation()
# Try to access core ... | diff --git a/src/pptx/presentation.py b/src/pptx/presentation.py
index a41bfd5..66fda11 100644
--- b/src/pptx/presentation.py
+++ a/src/pptx/presentation.py
@@ -31,7 +31,7 @@ class Presentation(PartElementProxy):
Provides read/write access to the Dublin Core document properties for the presentation.
... |
Error handling broken for name analysis in Python parser
#### Description
The Python error detection system is producing incorrect results when analyzing variable names in different contexts. Names in global statements, nonlocal statements, and function definitions are being misclassified, leading to improper error r... | diff --git a/parso/python/errors.py b/parso/python/errors.py
index 09c5047..43c4434 100644
--- b/parso/python/errors.py
+++ a/parso/python/errors.py
@@ -269,20 +269,20 @@ class _Context:
def add_name(self, name):
parent_type = name.parent.type
- if parent_type == 'global_stmt':
+ if parent... |
# tap() function in debug.py is broken and returns None instead of the input value
## Description
The `tap()` function in debug.py is not working as expected. It's supposed to print a value and return it, but it's returning `None` instead and the printing functionality is also broken.
## Steps to Reproduce
```pytho... | diff --git a/funcy/debug.py b/funcy/debug.py
index 62ef1bc..a004d44 100644
--- b/funcy/debug.py
+++ a/funcy/debug.py
@@ -23,10 +23,10 @@ REPR_LEN = 25
def tap(x, label=None):
"""Prints x and then returns it."""
if label:
- print('%s: %s' % (x, label))
+ print('%s: %s' % (label, x))
else:
-... |
Choice.__contains__ returns incorrect results
#### Description
The `__contains__` method in the Choice class is returning incorrect boolean values when checking if a component name exists in the choice.
#### Steps/Code to Reproduce
```python
from pyasn1.type import univ, namedtype
# Create a Choice with named comp... | diff --git a/pyasn1/type/univ.py b/pyasn1/type/univ.py
index 9aff5e6..b805e4d 100644
--- b/pyasn1/type/univ.py
+++ a/pyasn1/type/univ.py
@@ -3033,8 +3033,8 @@ class Choice(Set):
def __contains__(self, key):
if self._currentIdx is None:
- return True
- return key != self.componentType[s... |
# to_snake function breaks when converting camelCase to snake_case
## Description
The `to_snake` function in `pydantic/alias_generators.py` is not correctly converting camelCase strings to snake_case in certain scenarios. The function is supposed to handle various naming conventions and convert them to snake_case, bu... | diff --git a/pydantic/alias_generators.py b/pydantic/alias_generators.py
index 0b7653f..bccf31b 100644
--- b/pydantic/alias_generators.py
+++ a/pydantic/alias_generators.py
@@ -49,13 +49,14 @@ def to_snake(camel: str) -> str:
Returns:
The converted string in snake_case.
"""
- # `(?<=[a-zA-Z])(?=[0... |
PilImage.new_image method missing causes AttributeError when creating QR codes
When trying to create QR codes using the PIL image factory, I'm getting an AttributeError because the `new_image` method is missing from the PilImage class.
#### Steps/Code to Reproduce
```python
import qrcode
# Basic QR code creation fa... | diff --git a/qrcode/image/pil.py b/qrcode/image/pil.py
index 57ee13a..67c3925 100644
--- b/qrcode/image/pil.py
+++ a/qrcode/image/pil.py
@@ -9,6 +9,40 @@ class PilImage(qrcode.image.base.BaseImage):
kind = "PNG"
+ def new_image(self, **kwargs):
+ if not Image:
+ raise ImportError("PIL libr... |
# MoneyWidget.decompress() returns values in wrong order
## Description
I found a bug in the MoneyWidget's decompress method. When using a form with a Money field, the currency and amount values are swapped, causing validation issues and incorrect display of default currency.
## To Reproduce
Create a form with a Mo... | diff --git a/djmoney/forms/widgets.py b/djmoney/forms/widgets.py
index 3217654..9d46201 100644
--- b/djmoney/forms/widgets.py
+++ a/djmoney/forms/widgets.py
@@ -25,6 +25,6 @@ class MoneyWidget(MultiWidget):
def decompress(self, value):
if value is not None:
if isinstance(value, (list, tuple))... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.