mteb/LocBenchRR huggingface dataset:
Dead code in URLValidator
Description
	 
There's some dead code in django.core.validators.URLValidator which could be removed:
The entire ​Trivial case failed. Try for possible IDN domain section is no longer useful. This code attempts to re-validate a failed URL after encoding an international domain name using IDNA 2003 ("punycode"). But the URLValidator regular expressions have allowed all IDNs since ​Commit 2e65d56 (for #20003, in 2015), so the super call will never fail with a validation error that switching to IDNA 2003 would let pass.
The ​`ul` unicode letters property is no longer used. The regular expressions that had used it were moved into DomainNameValidator in ​Commit 4971a9a (for #18119, in Django 5.1).
For the first case, one way to verify the code is no longer in use is to run URLValidator on https://މިހާރު.com, which is a domain allowed by IDNA 2008 but prohibited by IDNA 2003. If the punycode() branch were coming into play, that URL would be rejected:
from django.core.validators import URLValidator
URLValidator()("https://މިހާރު.com")
# (No error)
from django.utils.encoding import punycode
punycode("މިހާރު.com")
# UnicodeError: Violation of BIDI requirement 3
# encoding with 'idna' codec failed
linkcheck performance: downloading page multiple times when checking anchors
### Problem
- If my sphinx documentation contains multiple links with anchors to a web page with multiple anchors, it will download the page multiple times, once per anchor to check
- This scales very badly.  If I have many hundreds or thousands of anchors (e.g. for automatically generated documentation), it might download several megabytes × the number of links.  This can end up being multiple gigabytes

#### Procedure to reproduce the problem

- create a document with links to anchors on the same web page
- run the link checker; it will fetch the page multiple times

#### Expected results

- I would suggest that the link checker could cache the anchors on webpages, so that it only downloads each page once, and only checks each link once.  It could build a dictionary of pages to check, and store the anchors as a list or dict within it?  Since we know up front which of our links have anchors, we can skip storing them when we know it's unnecessary.
- There may be other better ways of doing this; I'm not familiar with the internals of the link checker.

### Reproducible project / your project
- https://github.com/openmicroscopy/bioformats/tree/develop/docs/sphinx
- contains lots of links to https://www.openmicroscopy.org/Schemas/Documentation/Generated/OME-2016-06/ome_xsd.html

### Environment info
- OS: Any
- Python version: Any
- Sphinx version: Any
`client/orchestration.py/update_deployment_schedule` should be update with `active` and `schedule` at once
### First check

- [X] I added a descriptive title to this issue.
- [X] I used the GitHub search to find a similar request and didn't find it.
- [X] I searched the Prefect documentation for this feature.

### Prefect Version

2.x

### Describe the current behavior

I am trying to change the schedule of a deployment from an external service (a client service I am creating). I am trying to update the cron using this function, but the behavior is different from what I expected, so I would like to confirm.
In this function, lines 1953 to 1956 are written as follows:
https://github.com/PrefectHQ/prefect/blob/1d1499a900fb4a68029a0c206b43140b0703a1b6/src/prefect/client/orchestration.py#L1953-L1956

### Describe the proposed behavior

It's should be following:

```python
if active is not None:
    kwargs["active"] = active

if schedule is not None:
    kwargs["schedule"] = schedule
```

### Example Use


```python
import asyncio
from prefect.client.orchestration import PrefectClient
from prefect.client.schemas.schedules import construct_schedule

async def updateDeploymentSchedule():
    client = PrefectClient(api="http://127.0.0.1:4200/api")
    target_deployment = await client.read_deployment_by_name("foo/bar")
    schedule_id = target_deployment.schedules[0].id
    cron =construct_schedule(cron="0 5 * * *",timezone="Asia/Tokyo") 
    _ = await client.update_deployment_schedule(deployment_id=target_deployment.id, schedule_id=schedule_id, schedule=cron, active=True)

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(updateDeploymentSchedule())
```

### Additional context

I mentioned about this issue in [slack channnel](https://prefect-community.slack.com/archives/CL09KU1K7/p1714642952657639)
Union between a callable and a type not respected by functools.partial
Seems similar to #17646 but not fixed in https://mypy-play.net/?mypy=master&python=3.12
The linked #17659 is not applicable because I am not using Self.

Sample code:
```python
import functools
import typing as T
from typing_extensions import TypeAlias

FooBarFunc: TypeAlias = T.Callable[..., 'FooBar']

class FooBar:
    def __init__(self, arg1: str) -> None:
        pass

def transform(t: T.Union[T.Type[FooBar], FooBarFunc]) -> None:
    val = functools.partial(t)
```

Error:
```
main.py:12: error: "type[FooBar] | Callable[..., FooBar]" not callable  [misc]
```

The codebase where this was discovered: https://github.com/mesonbuild/meson/blob/83f8de5357f31d6448ae033e1e8ed2b22c8c306a/mesonbuild/dependencies/factory.py#L75-L95

```
mesonbuild/dependencies/factory.py:95:38: error: "type[CMakeDependency] | Callable[..., CMakeDependency]" not callable  [misc]
```

Both sides of the union if cast and used independently, work.
[Whisper] Computing features on CPU slows down WhisperFeatureExtractor
### Feature request

In the WhisperFeatureExtractor class, to reduce the time it takes to compute audio features, an option should be added to compute the features on GPU in batch mode.

### Motivation

Currently, the Whisper Feature Extractor processes audio features on the CPU one by one for each batch, which slows down the process. Additionally, it doesn't utilize GPU operations despite using torch functions.

We ( + @vaibhavagg303 ) modified the code to enable batch feature extraction on CPU, cutting the average time for batches of 8 from 1.5 seconds to 0.25 seconds — depending on available CPU resources. Furthermore, we transferred all variables — mel filters and hanning window — in the function __torch_extract_fbank_features_  to GPU, further reducing **the average time to 0.02 seconds — a significant reduction from 1.5 seconds.**

Whisper Models, already with high latency, experience even greater latency due to processing input features on the CPU without batching. By doing batch-wise inference on GPU, the total inference time for Whisper-Small is reduced significantly, **bringing it down by whopping 25%.** 

@sanchit-gandhi 

The code used to measure the time taken is as follows. 
```
from transformers import WhisperProcessor, WhisperForConditionalGeneration
feature_extractor = WhisperFeatureExtractor.from_pretrained("openai/whisper-small")
import librosa
import time

processor = WhisperProcessor.from_pretrained("openai/whisper-small", language='english')
model = WhisperForConditionalGeneration.from_pretrained("openai/whisper-small")
model.config.forced_decoder_ids = None
model = model.to('cuda')

total_time = 0
batch_size= 8

for i in range(0, len(df), batch_size):
  sample = df[i:i+ batch_size]
  files = sample['file'].tolist()
  sample_array = []
  for file in files:
    data, sample_rate = librosa.load(file, sr = 16000)
    sample_array.append(data)
 
 st = time.time()
  input_features = feature_extractor(sample_array, sampling_rate=16000).input_features
  input_features = torch.tensor(input_features).to('cuda')

  with torch.no_grad():
    predicted_ids = model.generate(input_features, language='english')
  transcription = processor.batch_decode(predicted_ids, skip_special_tokens=True)

  total_time += time.time() - st
```


### Your contribution

This is the PR by @vaibhavagg303.
https://github.com/huggingface/transformers/pull/29900
Invalid WAF arn
### Steps to Reproduce

Run prowler on Docker against an account with global WAF enabled.

### Expected behavior

To pass

### Actual Result with Screenshots or Logs

2024-11-18 10:09:43,933 [File: wafv2_service.py:122]    [Module: wafv2_service]  ERROR: us-east-1 -- WAFInvalidParameterException[105]: An error occurred (WAFInvalidParameterException) when calling the ListResourcesForWebACL operation: Error reason: The ARN isn't valid. A valid ARN begins with arn: and includes other information separated by colons or slashes., field: RESOURCE_ARN, parameter: arn:aws:wafv2:us-east-1:xxxxx:global/webacl/xxx/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx

2024-11-18 10:09:43,934 [File: wafv2_service.py:122]    [Module: wafv2_service]  ERROR: us-east-1 -- WAFInvalidParameterException[105]: An error occurred (WAFInvalidParameterException) when calling the ListResourcesForWebACL operation: Error reason: The ARN isn't valid. A valid ARN begins with arn: and includes other information separated by colons or slashes., field: RESOURCE_ARN, parameter: arn:aws:wafv2:us-east-1:xxxxx:global/webacl/xxx/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx

2024-11-18 10:09:43,938 [File: wafv2_service.py:122]    [Module: wafv2_service]  ERROR: us-east-1 -- WAFInvalidParameterException[105]: An error occurred (WAFInvalidParameterException) when calling the ListResourcesForWebACL operation: Error reason: The ARN isn't valid. A valid ARN begins with arn: and includes other information separated by colons or slashes., field: RESOURCE_ARN, parameter: arn:aws:wafv2:us-east-1:xxxxx:global/webacl/xxx/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx

### How did you install Prowler?

Docker (docker pull toniblyx/prowler)

### Environment Resource

3. Docker container locally

### OS used

One inside docker

### Prowler version

4.5.3

### Pip version

one inside docker image

### Context

We have three global WAF, and three regional WAF. The three regional works, and the three global throws an malformed arn error.
Improve vector tile performance
There are a few ways to improve vector tile performance if needed:
- [x] Download vector tile files to cache
- [x]  Filter features before doing merge and  crop step
- [x] In-memory cache (ideally LRU)
Unrecoverable failure in Jinja templating: `RelationEmulator` is not safely callable.
### Search before asking

- [X] I searched the [issues](https://github.com/sqlfluff/sqlfluff/issues) and found no similar issues.

- #3998 is similar, but not quite the same as it is related to custom macros.
- #6253 is the source of this issue.

### What Happened

When using `this.some_function()` in DBT models, SQLFLuff crashes with the following error:

```
Unrecoverable failure in Jinja templating:
<sqlfluff.core.templaters.jinja.JinjaTemplater._generate_dbt_builtins.<locals>.RelationEmulator
object at 0x109cfeef0> is not safely callable. Have you
correctly configured your variables?
https://docs.sqlfluff.com/en/latest/perma/variables.html
```

Is there any way to make the object "safely callable"?

### Expected Behaviour

It works.

### Observed Behaviour

It crashes.

### How to reproduce

Just lint a simple model like this:

```sql
{{ this.include(database = False) }}
```

### Dialect

Snowflake (but the issue should apply to all dialects using the Jinja templater)

### Version

==== sqlfluff ====
sqlfluff:                3.2.4 python:                 3.10.7
implementation:        cpython verbosity:                   1
dialect:             snowflake templater:               jinja
rules:                                all

### Configuration

[sqlfluff]
templater = jinja
dialect = snowflake

### Are you willing to work on and submit a PR to address the issue?

- [x] Yes I am willing to submit a PR!

### Code of Conduct

- [X] I agree to follow this project's [Code of Conduct](https://github.com/sqlfluff/sqlfluff/blob/main/CODE_OF_CONDUCT.md)
Allow specifying `exec_time_optimization_effort` and `memory_fitting_effort` via CLI.
New compiler options (see title) have recently been [exposed](https://github.com/jax-ml/jax/issues/24625) in JAX.

To use them users have to change their Python code like this:

```
jax.jit(f, compiler_options={
  "exec_time_optimization_effort": 0.5, # change here
 })
``` 

It would be very convenient to not modify the code but rely on CLI instead. For example:

```
JAX_EXEC_TIME_OPTIMIZATION_EFFORT=0.5 python3 jax_program.py
```
'ninja install' attempts to gain elevated privileges
It is disturbing for 'ninja install' to prompt for a sudo password with polkit.

This breaks user expectations, and introduces a security risk.

This has evidently been meson's behavior for a very long time, but it's distressing, and it's surprising because meson is usually so keen on simplicity; the last thing I expect when invoking a build tool is for it to take over the screen and request a password.

(It would be equally distressing for 'sudo ninja install' to clutter the local directory with root-owned files.)
pkexec logic is a bad idea
This is a bit related to https://github.com/mesonbuild/meson/issues/4758

Basically, what you're doing with polkit doesn't make sense.  You're allowing to execute arbitrary code (in the Meson build logic) as root; the permission isn't actually limited in any way.  So rather than having meson contain logic to run `pkexec` it's just much saner to tell people to do `sudo meson install` (or `pkexec meson install`) etc.

IOW you should just delete the polkit rules and print an error message telling people how to use `sudo/pkexec` (this is quite commonly documented for other build systems of course).
'ninja install' attempts to gain elevated privileges
It is disturbing for 'ninja install' to prompt for a sudo password with polkit.

This breaks user expectations, and introduces a security risk.

This has evidently been meson's behavior for a very long time, but it's distressing, and it's surprising because meson is usually so keen on simplicity; the last thing I expect when invoking a build tool is for it to take over the screen and request a password.

(It would be equally distressing for 'sudo ninja install' to clutter the local directory with root-owned files.)
pkexec logic is a bad idea
This is a bit related to https://github.com/mesonbuild/meson/issues/4758

Basically, what you're doing with polkit doesn't make sense.  You're allowing to execute arbitrary code (in the Meson build logic) as root; the permission isn't actually limited in any way.  So rather than having meson contain logic to run `pkexec` it's just much saner to tell people to do `sudo meson install` (or `pkexec meson install`) etc.

IOW you should just delete the polkit rules and print an error message telling people how to use `sudo/pkexec` (this is quite commonly documented for other build systems of course).
[WIP] : Added assert_consistent_docs() and related tests

Fixes #9388 

Added a function to check for consistency between docstring of objects.

In this approach there is a python dictionary for each of Parameters, Attributes and Returns. Indexed by the name of the parameter/attribute/return with the value being a Python dictionary containing its type definition and description. The function checks for each object if the docstring is identical (excluding whitespaces) for a given parameter/attribute/return in the main dictionary. If a new parameter/attribute/return are found they are added in the main dictionary.
[Data] Inconsistent behavior with Ray Data and timestamps
### What happened + What you expected to happen

*This example has been provided as a gist instead of in-line code to make it easier to reproduce and trace.

Two odd behaviors are identified:
1. When working with flat-structured datasets, ray data performs destructive type conversions when using the `.map()` API.
2. When working with nest-structed datasets (ie. data with sub-structs), ray data performs destructive type conversions when using the `.map_batches()` (or `.take_batches()`) API.

The first issue is isolated to just `ray.data`, while the second is demonstrated to fail with the `pandas` API as well.

This currently blocks me from using ray data as I cannot extract timestamps consistently across my data sources.

### Versions / Dependencies

Name: numpy
Version: 1.24.4

Name: pandas
Version: 2.0.3

Name: pyarrow
Version: 17.0.0

Name: ray
Version: 2.10.0

Name: host
Version: Darwin [hostname-redacted] 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:13:18 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6030 arm64

### Reproduction script

Gist: https://gist.github.com/NellyWhads/fdfb261a027be7e7bc87bec91d9e9035

### Issue Severity

High: It blocks me from completing my task.
sdba - improve the speed of DetrendedQuantileMapping
### Description
Doing a few preliminary tests **on a single pixel and without dask**, I obtained the following times : 

DetrendedQuantileMapping, groups='month', 150 years of daily data : ~15 seconds
DetrendedQuantileMapping, groups='day', window=31, 150 years of daily data : ~24 seconds

EmpiricalQuantileMapping, groups='month', 150 years of daily data : ~0.35 seconds
EmpiricalQuantileMapping, groups='day', window=31, 150 years of daily data : ~2.5 seconds

There seems to be a bottleneck in the detrending version. Discussions with @aulemahal point towards the normalization process and `sdba.utils.interp_on_quantiles`. I will continue investigating and post my findings here.
Remove `prefect deployment build` CLI from the `main` branch
Remove the `prefect.cli.deployment.build` function and any references to it. Any private code that was used solely for that function should also be deleted. This CLI command will be included in 2.x releases, but will not be included in the 3.0 release.
"view on site" URL doesn't accept non-integer ContentType pks
Description
	 
Most admin URL paths use the path converter to allow any type of ID, however, the "view on site" uses the int converter for content_type_id.
This doesn't work on MongoDB which uses ObjectIdAutoField (bson.ObjectId) for all models since AutoField isn't supported.
Urlize incorrectly handles punctuation in email addresses
Description
	 
Several punctuation characters (%, &, +, !, etc.) can—and sometimes do—appear in the local part of an email address (before the @). The urlize template filter doesn't correctly encode them, which can result in broken mailto links.
Example (Django 5.1.4):
from django.template.defaultfilters import urlize
urlize("it%dept@example.org")
# '<a href="mailto:it%dept@example.org">it%dept@example.org</a>'
# Expected:
# '<a href="mailto:it%25dept@example.org">it%dept@example.org</a>'
Clicking the resulting mailto link might work as expected, or do nothing, or could launch a mail composer with a missing or incorrect email address, depending on the specific address, browser and email app. Sequences that could also be percent-encoded characters (like "%de" in the example) are especially prone to unpredictable results.
The mailto URI spec ​RFC 6068 requires percent encoding most punctuation in this situation (section 2, item 1; also see section 5, Encoding).
Proposed fix: apply urllib.parse.quote() to local where the ​mailto link is constructed in django.utils.html.Urlizer. (Although not strictly necessary, it wouldn't hurt to also quote domain there.)
DOC: Incorrect deprecation example for `is_period_dtype`
### Pandas version checks

- [X] I have checked that the issue still exists on the latest versions of the docs on `main` [here](https://pandas.pydata.org/docs/dev/)


### Location of the documentation

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.api.types.is_period_dtype.html#pandas.api.types.is_period_dtype

### Documentation problem

Suggests the user use `isinstance(dtype, pd.Period)` instead, when they really need to use `Use isinstance(dtype, pd.PeriodDtype)`

### Suggested fix for documentation

Update message to reference correct class
DynamoDB should raise a ValidationError when ADD and DELETE statements include the same document path
DynamoDB does not support ADD and DELETE actions on the same string set in the same UpdateItem call. Here's a test to demonstrate:

```python
from unittest import TestCase

import boto3
from botocore.exceptions import ClientError
from moto import mock_aws


@mock_aws
class TestEmptyStringSet(TestCase):
    """
    DynamoDB will return a ValidationError, if you try to ADD and DELETE to the same String Set. This can be confirmed
    by running this test against a real AWS account, without the @mock_aws decorator.
    """

    def test_validation_error_on_delete_and_add(self):
        self._table.put_item(Item={'pk': 'foo', 'string_set': {'a', 'b'}})

        with self.assertRaises(ClientError) as e:
            self._table.update_item(
                Key={'pk': 'foo'},
                UpdateExpression='ADD #stringSet :addSet  DELETE #stringSet :deleteSet',
                ExpressionAttributeNames={'#stringSet': 'string_set'},
                ExpressionAttributeValues={':addSet': {'c'}, ':deleteSet': {'a'}},
            )
        self.assertEqual('ValidationException', e.exception.response['Error']['Code'])
        self.assertTrue(
            e.exception.response['Error']['Message'].startswith(
                'Invalid UpdateExpression: Two document paths overlap with each other;'
            )
        )

    def setUp(self):
        self._table_name = 'example-test-table'
        self._client = boto3.client('dynamodb')
        self._table = boto3.resource('dynamodb').create_table(
            AttributeDefinitions=[{'AttributeName': 'pk', 'AttributeType': 'S'}],
            TableName=self._table_name,
            KeySchema=[{'AttributeName': 'pk', 'KeyType': 'HASH'}],
            BillingMode='PAY_PER_REQUEST',
        )
        waiter = self._client.get_waiter('table_exists')
        waiter.wait(TableName=self._table_name)

    def tearDown(self):
        self._table.delete()
        waiter = self._client.get_waiter('table_not_exists')
        waiter.wait(TableName=self._table_name)
```
[Bug]: inconsistent ‘animation.FuncAnimation’ between display and save
### Bug summary

when i want to save images to gif,  it's inconsistent between display and save; 

It seems that the color information has been lost:

![temp](https://github.com/user-attachments/assets/f1a6c123-2533-4db0-8c14-4264cfe3345c)


### Code for reproduction

```Python
def animation_test():
    import matplotlib.pyplot as plt
    import matplotlib.animation as animation
    file = r'example.dat'
    num_frames = 72
    nx = 8
    ny = 9
    data = np.fromfile(file, np.float32).reshape(num_frames, ny, nx)

    fig, ax = plt.subplots()
    img = data[0,]
    # plt.imshow(img)
    vmax = 100
    vmin = 0
    h = ax.imshow(img, cmap=plt.get_cmap('CMRmap_r'), origin='lower', interpolation='none', vmin=vmin, vmax=vmax, animated=True)
    ax.set_xticks(range(nx))
    ax.set_xticklabels(range(1, nx + 1))
    ax.set_yticks(range(ny))
    ax.set_yticklabels(range(1, ny + 1))
    fig.tight_layout()

    def update(frame):
        img = data[frame, ]
        h.set_array(img)
        return h,

    # create animation
    interval = 100
    ani = animation.FuncAnimation(fig, update, frames=range(num_frames), interval=interval, blit=True)
    # ani = animation.FuncAnimation(fig, update, frames=frame_iter, interval=interval, blit=False, cache_frame_data=False)

    ani.save('example.gif', writer='pillow', fps=2, dpi=300)

    pass

if __name__ == '__main__':
    animation_test()
```


### Actual outcome

above picture -> right

### Expected outcome

above picture -> left

### Additional information

_No response_

### Operating system

win10

### Matplotlib Version

'3.4.2'

### Matplotlib Backend

_No response_

### Python version

3.7.10

### Jupyter version

_No response_

### Installation

pip