Northy1717/SWE-bench-Live huggingface dataset:
Repository: beetbox/beets

Issue:
ftintitle duplicates feature part if in parentheses
### Problem

When running `beet ftintitle` multiple times, the feature X part gets repeated, if the feature X part is in parentheses.

```sh
$ beet ftintitle
ftintitle: /Music/01 Title (feat. Second Artist).flac
ftintitle: artist: First Artist feat. Second Artist (Not changing due to keep_in_artist)
ftintitle: title: Title (feat. Second Artist) -> Title (feat. Second Artist) (feat. Second Artist)
```

### Reason
The `ftintitle.contains_feat` function uses the regular expression `feat_tokens` from `beets/plugins.py` to match existing feat. X parts. However, the current regex does only match feat. X parts when they are preceded by a space (not parentheses).

```python
>>> from beetsplug import ftintitle
>>> ftintitle.contains_feat("Title (feat. Second Artist)")
False
>>> ftintitle.contains_feat("Title feat. Second Artist")
True
```

### Setup

* OS: Linux
* Python version: 3.12
* beets version: master branch @ cd360b6a99bef5f8b5e4ffce334e89b580bbd652


Discussion:

Patch:
diff --git a/beets/plugins.py b/beets/plugins.py
index 0864c4b9b0..299c418157 100644
--- a/beets/plugins.py
+++ b/beets/plugins.py
@@ -518,7 +518,7 @@ def feat_tokens(for_artist=True):
     feat_words = ["ft", "featuring", "feat", "feat.", "ft."]
     if for_artist:
         feat_words += ["with", "vs", "and", "con", "&"]
-    return r"(?<=\s)(?:{})(?=\s)".format(
+    return r"(?<=[\s(\[])(?:{})(?=\s)".format(
         "|".join(re.escape(x) for x in feat_words)
     )
 
diff --git a/docs/changelog.rst b/docs/changelog.rst
index 38e7642264..33a4b5f94d 100644
--- a/docs/changelog.rst
+++ b/docs/changelog.rst
@@ -26,6 +26,8 @@ New features:
 
 Bug fixes:
 
+* The detection of a "feat. X" part now also matches such parts if they are in
+  parentheses or brackets. :bug:`5436`
 * Improve naming of temporary files by separating the random part with the file extension.
 * Fix the ``auto`` value for the :ref:`reflink` config option.
 * Fix lyrics plugin only getting part of the lyrics from ``Genius.com`` :bug:`4815`


Test patch:
diff --git a/test/plugins/test_ftintitle.py b/test/plugins/test_ftintitle.py
index 45146b42b7..9e8f14fe1a 100644
--- a/test/plugins/test_ftintitle.py
+++ b/test/plugins/test_ftintitle.py
@@ -183,5 +183,10 @@ def test_contains_feat(self):
         assert ftintitle.contains_feat("Alice & Bob")
         assert ftintitle.contains_feat("Alice and Bob")
         assert ftintitle.contains_feat("Alice With Bob")
+        assert ftintitle.contains_feat("Alice (ft. Bob)")
+        assert ftintitle.contains_feat("Alice (feat. Bob)")
+        assert ftintitle.contains_feat("Alice [ft. Bob]")
+        assert ftintitle.contains_feat("Alice [feat. Bob]")
         assert not ftintitle.contains_feat("Alice defeat Bob")
         assert not ftintitle.contains_feat("Aliceft.Bob")
+        assert not ftintitle.contains_feat("Alice (defeat Bob)")
Repository: joke2k/faker

Issue:
pydecimal mishandles max_value and min_value when used with left_digits/right_digits
* Faker version: 28.1.0
* OS: linux

Brief summary of the issue goes here.

### Steps to reproduce

```python
import faker

fake = faker.Faker()
faker.Faker.seed("6")
fake.pydecimal(left_digits=1, right_digits=1, max_value=0.3, min_value=0.2)
# returns Decimal('0.200000000000000011102230246251565404236316680908203125')
faker.Faker.seed("3")
fake.pydecimal(left_digits=1, right_digits=1, max_value=0.3, min_value=0.2)
# returns Decimal('0.299999999999999988897769753748434595763683319091796875')
```

### Expected behavior

Faker should return Decimal('0.2') and Decimal('0.3')



Discussion:

Patch:
diff --git a/faker/providers/python/__init__.py b/faker/providers/python/__init__.py
index d601c8d4eb..374a5793ed 100644
--- a/faker/providers/python/__init__.py
+++ b/faker/providers/python/__init__.py
@@ -352,9 +352,9 @@ def pydecimal(
         # Because the random result might have the same number of decimals as max_value the random number
         # might be above max_value or below min_value
         if max_value is not None and result > max_value:
-            result = Decimal(max_value)
+            result = Decimal(str(max_value))
         if min_value is not None and result < min_value:
-            result = Decimal(min_value)
+            result = Decimal(str(min_value))
 
         return result
 


Test patch:
diff --git a/tests/providers/test_python.py b/tests/providers/test_python.py
index 4b89ebc377..5af45bf245 100644
--- a/tests/providers/test_python.py
+++ b/tests/providers/test_python.py
@@ -506,6 +506,16 @@ def test_min_value_10_pow_1000_return_greater_number(self):
         result = self.fake.pydecimal(min_value=10**1000)
         self.assertGreater(result, 10**1000)
 
+    def test_min_value_float_returns_correct_digit_number(self):
+        Faker.seed("6")
+        result = self.fake.pydecimal(left_digits=1, right_digits=1, min_value=0.2, max_value=0.3)
+        self.assertEqual(decimal.Decimal("0.2"), result)
+
+    def test_max_value_float_returns_correct_digit_number(self):
+        Faker.seed("3")
+        result = self.fake.pydecimal(left_digits=1, right_digits=1, min_value=0.2, max_value=0.3)
+        self.assertEqual(decimal.Decimal("0.3"), result)
+
 
 class TestPystr(unittest.TestCase):
     def setUp(self):
Repository: pdm-project/pdm

Issue:
`/` is not URL encoded in environment variables
On `pdm==2.18.2` (but on earlier version too), slash is not URL encoded in sources environment variables.

## Steps to reproduce

Have a `/` character in the source environment variables.

## Actual behavior

Every character except `/` is URL encoded making authentication fail if you user or password contains a slash (which is actually the case for Artifactory OIDC auth)

## Expected behavior

`/` is URL encoded too



Discussion:

Patch:
diff --git a/news/3169.bugfix.md b/news/3169.bugfix.md
new file mode 100644
index 0000000000..1d0c0482d9
--- /dev/null
+++ b/news/3169.bugfix.md
@@ -0,0 +1,1 @@
+Ensures that  `/` is URL encoded in sources URL environment variables.
diff --git a/src/pdm/utils.py b/src/pdm/utils.py
index a474d91351..6b62d671f8 100644
--- a/src/pdm/utils.py
+++ b/src/pdm/utils.py
@@ -244,7 +244,7 @@ def expand_env_vars(credential: str, quote: bool = False, env: Mapping[str, str]
 
     def replace_func(match: Match) -> str:
         rv = env.get(match.group(1), match.group(0))
-        return parse.quote(rv) if quote else rv
+        return parse.quote(rv, "") if quote else rv
 
     return re.sub(r"\$\{(.+?)\}", replace_func, credential)
 


Test patch:
diff --git a/tests/test_utils.py b/tests/test_utils.py
index 7461d71d35..a2122fb5a0 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -217,11 +217,11 @@ def test_expand_env_vars(given, expected, monkeypatch):
         ("https://example.org/path?arg=1", "https://example.org/path?arg=1"),
         (
             "https://${FOO}@example.org/path?arg=1",
-            "https://hello@example.org/path?arg=1",
+            "https://token%3Aoidc%2F1@example.org/path?arg=1",
         ),
         (
             "https://${FOO}:${BAR}@example.org/path?arg=1",
-            "https://hello:wo%3Arld@example.org/path?arg=1",
+            "https://token%3Aoidc%2F1:p%40ssword@example.org/path?arg=1",
         ),
         (
             "https://${FOOBAR}@example.org/path?arg=1",
@@ -230,8 +230,8 @@ def test_expand_env_vars(given, expected, monkeypatch):
     ],
 )
 def test_expand_env_vars_in_auth(given, expected, monkeypatch):
-    monkeypatch.setenv("FOO", "hello")
-    monkeypatch.setenv("BAR", "wo:rld")
+    monkeypatch.setenv("FOO", "token:oidc/1")
+    monkeypatch.setenv("BAR", "p@ssword")
     assert utils.expand_env_vars_in_auth(given) == expected
Repository: pytorch/torchtune

Issue:
Llama3 Tokenizer always appends "eos_id" for tokenize_messages
Llama3Tokenizer `tokenize_messages` method calls `truncate(tokens, self.max_seq_len, self.eos_id)` at the end of the method regardless of whether add_eos is True or False. `truncate` will add eos_id everytime self.eos_id is passed to it. There should be two fixes,  only truncate when `len(tokens) > self.max_seq_len`, and only pass `self.eos_id` to truncate when `add_eos` is True.


Discussion:

Patch:
diff --git a/torchtune/models/llama3/_tokenizer.py b/torchtune/models/llama3/_tokenizer.py
index 3334dd0e8d..3b765ae864 100644
--- a/torchtune/models/llama3/_tokenizer.py
+++ b/torchtune/models/llama3/_tokenizer.py
@@ -272,8 +272,10 @@ def tokenize_messages(
             tokens = tokens + [self.eos_id]
             mask = mask + [True]
         if self.max_seq_len:
-            tokens = truncate(tokens, self.max_seq_len, self.eos_id)
-            mask = truncate(mask, self.max_seq_len, True)
+            tokens = truncate(
+                tokens, self.max_seq_len, self.eos_id if add_eos else None
+            )
+            mask = truncate(mask, self.max_seq_len, True if add_eos else None)
 
         return tokens, mask
 


Test patch:
diff --git a/tests/torchtune/models/llama3/test_llama3_tokenizer.py b/tests/torchtune/models/llama3/test_llama3_tokenizer.py
index 5643a40c2d..e2f7fd0410 100644
--- a/tests/torchtune/models/llama3/test_llama3_tokenizer.py
+++ b/tests/torchtune/models/llama3/test_llama3_tokenizer.py
@@ -17,6 +17,7 @@ def tokenizer(self):
         # https://gist.github.com/ebsmothers/54b133dd87db6679b14318545aaa2de4
         return llama3_tokenizer(
             path=str(ASSETS / "tiktoken_small.model"),
+            max_seq_len=2048,
         )
 
     @pytest.fixture
@@ -323,6 +324,21 @@ def test_tokenize_text_messages(
         assert tokens == expected_tokens
         assert mask == expected_mask
 
+    def test_tokenize_message_drop_eos(
+        self, tokenizer, user_text_message, assistant_text_message
+    ):
+        """Test that the tokenizer will not add an EOS token if user requests it."""
+        text_messages = [user_text_message[0], assistant_text_message[0]]
+        # Chop the end of the assistant message to remove the EOS token
+        expected_tokens = user_text_message[1] + assistant_text_message[1][:-1]
+        # No need to mask out the EOS token at the end since it's not there
+        expected_mask = [True] * len(user_text_message[1]) + [False] * (
+            len(assistant_text_message[1]) - 1
+        )
+        tokens, mask = tokenizer.tokenize_messages(text_messages, add_eos=False)
+        assert tokens == expected_tokens
+        assert mask == expected_mask
+
     def test_tokenize_image_and_text_messages(
         self, tokenizer, user_image_text_message, assistant_text_message
     ):
Repository: sissbruecker/linkding

Issue:
consistent ordering of multiple tags on a bookmark
From what I can tell, every time a page is loaded in linkding, the tags on a given bookmark are shown in an essentially random order. If you're a person whose use case involves a significant number of tags, it becomes difficult to quickly skim the tags to see what tags a bookmark has. 

Having them show up in some kind of consistent order would be helpful in this situation. Alphabetical would work, as would the order the tags were input. I don't have strong feelings about which would be superior, I'd just like to be able to know what to expect from the order of tags.


Discussion:

Patch:
diff --git a/bookmarks/models.py b/bookmarks/models.py
index f4db7d56..01fbcac0 100644
--- a/bookmarks/models.py
+++ b/bookmarks/models.py
@@ -84,7 +84,8 @@ def resolved_description(self):
 
     @property
     def tag_names(self):
-        return [tag.name for tag in self.tags.all()]
+        names = [tag.name for tag in self.tags.all()]
+        return sorted(names)
 
     def __str__(self):
         return self.resolved_title + " (" + self.url[:30] + "...)"


Test patch:
diff --git a/bookmarks/tests/test_bookmarks_list_template.py b/bookmarks/tests/test_bookmarks_list_template.py
index a8658f40..c6c4d756 100644
--- a/bookmarks/tests/test_bookmarks_list_template.py
+++ b/bookmarks/tests/test_bookmarks_list_template.py
@@ -457,6 +457,22 @@ def test_bookmark_description_max_lines(self):
         style = bookmark_list["style"]
         self.assertIn("--ld-bookmark-description-max-lines:3;", style)
 
+    def test_bookmark_tag_ordering(self):
+        bookmark = self.setup_bookmark()
+        tag3 = self.setup_tag(name="tag3")
+        tag1 = self.setup_tag(name="tag1")
+        tag2 = self.setup_tag(name="tag2")
+        bookmark.tags.add(tag3, tag1, tag2)
+
+        html = self.render_template()
+        soup = self.make_soup(html)
+        tags = soup.select_one(".tags")
+        tag_links = tags.find_all("a")
+        self.assertEqual(len(tag_links), 3)
+        self.assertEqual(tag_links[0].text, "#tag1")
+        self.assertEqual(tag_links[1].text, "#tag2")
+        self.assertEqual(tag_links[2].text, "#tag3")
+
     def test_should_render_web_archive_link_with_absolute_date_setting(self):
         bookmark = self.setup_date_format_test(
             UserProfile.BOOKMARK_DATE_DISPLAY_ABSOLUTE,