nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: kmyk/online-judge-tools
Pull request #557 (2019-10-17 13:14:21)

None: fix null.


Patch:
diff --git a/onlinejudge/service/atcoder.py b/onlinejudge/service/atcoder.py
index 1c8b0e0..25f086c 100644
--- a/onlinejudge/service/atcoder.py
+++ b/onlinejudge/service/atcoder.py
@@ -326,6 +326,8 @@ class AtCoderContest(onlinejudge.type.Contest):
         """
 
         result = urllib.parse.urlparse(url)
+        if result.hostname is None:
+            return None
 
         # example: https://kupc2014.contest.atcoder.jp/tasks/kupc2014_d
         if result.scheme in ('', 'http', 'https') and result.hostname.endswith('.contest.atcoder.jp'):


Test patch:
diff --git a/tests/dispatch.py b/tests/dispatch.py
index fb67811..e532754 100644
--- a/tests/dispatch.py
+++ b/tests/dispatch.py
@@ -64,6 +64,7 @@ class InvalidDispatchTest(unittest.TestCase):
 
     def test_contest_from_url(self):
         self.assertIsNone(dispatch.contest_from_url('https://atcoder.jp/'))
+        self.assertIsNone(dispatch.contest_from_url('https://'))
 
     def test_service_from_url(self):
         self.assertIsNone(dispatch.service_from_url('https://www.yahoo.co.jp/'))
Repository: kmyk/online-judge-tools
Pull request #738 (2020-04-26 20:42:00)

Support new URL of AOJ
#737 

https://onlinejudge.u-aizu.ac.jp/problems/{problem_id}
という形のURLを認識できるように変更しました。

あまり慣れていないのですが、プルリクこんな感じで大丈夫でしょうか…？


Patch:
diff --git a/onlinejudge/service/aoj.py b/onlinejudge/service/aoj.py
index 53f407e..ecbc5c9 100644
--- a/onlinejudge/service/aoj.py
+++ b/onlinejudge/service/aoj.py
@@ -141,6 +141,15 @@ class AOJProblem(onlinejudge.type.Problem):
             n = m.group(5)
             return cls(problem_id=n)
 
+        # example: https://onlinejudge.u-aizu.ac.jp/problems/0423
+        # example: https://onlinejudge.u-aizu.ac.jp/problems/CGL_3_B
+        m = re.match(r'^/problems/(\w+)$', utils.normpath(result.path))
+        if result.scheme in ('', 'http', 'https') \
+                and result.netloc == 'onlinejudge.u-aizu.ac.jp' \
+                and m:
+            n = m.group(1)
+            return cls(problem_id=n)
+
         return None
 
     def get_service(self) -> AOJService:


Test patch:
diff --git a/tests/command_download_aoj.py b/tests/command_download_aoj.py
index e182274..69dabca 100644
--- a/tests/command_download_aoj.py
+++ b/tests/command_download_aoj.py
@@ -63,6 +63,18 @@ class DownloadAOJTest(unittest.TestCase):
             'judge_data.out': '8d2f7846dc2fc10ef37dcb548635c788',
         }, is_system=True)
 
+    def test_call_download_aoj_system_problems_ITP1_1_B(self):
+        self.snippet_call_download('https://onlinejudge.u-aizu.ac.jp/problems/ITP1_1_B', {
+            'test1.in': 'b026324c6904b2a9cb4b88d6d61c81d1',
+            'test1.out': 'b026324c6904b2a9cb4b88d6d61c81d1',
+            'test2.in': '6d7fce9fee471194aa8b5b6e47267f03',
+            'test2.out': '66a7c1d5cb75ef2542524d888fd32f4a',
+            'test3.in': '9caff0735bc6e80121cedcb98ca51821',
+            'test3.out': 'fef5f767008b27f5c3801382264f46ef',
+            'test4.in': '919d117956d3135c4c683ff021352f5c',
+            'test4.out': 'b39ffd5aa5029d696193c8362dcb1d19',
+        }, is_system=True)
+
 
 class DownloadAOJArenaTest(unittest.TestCase):
     def snippet_call_download(self, *args, **kwargs):
Repository: jkroepke/openvpn-auth-oauth2
Pull request #200 (2024-02-27 22:54:55)

Log client IP
#### What this PR does / why we need it

#### Which issue this PR fixes

*(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes #

- fixes #

#### Special notes for your reviewer

#### Particularly user-facing changes

#### Checklist

Complete these before marking the PR as `ready to review`:

<!-- [Place an '[x]' (no spaces) in all applicable fields.] -->

- [ ] [DCO](https://github.com/prometheus-community/helm-charts/blob/main/CONTRIBUTING.md#sign-off-your-work) signed
- [ ] The PR title has a summary of the changes
- [ ] The PR body has a summary to reflect any significant (and particularly user-facing) changes introduced by this PR



Patch:
diff --git a/internal/openvpn/connection/client.go b/internal/openvpn/connection/client.go
index f74ed44..3662407 100644
--- a/internal/openvpn/connection/client.go
+++ b/internal/openvpn/connection/client.go
@@ -43,14 +43,9 @@ func NewClient(conf config.Config, message string) (Client, error) { //nolint:cy
 				return Client{}, err
 			}
 		case strings.HasPrefix(line, ">CLIENT:ADDRESS"):
-			vpnIP, found := strings.CutPrefix(line, ">CLIENT:ADDRESS,")
-			if !found {
-				return Client{}, fmt.Errorf("unable to parse line: %s", line)
-			}
-
-			client.VPNAddress, _, found = strings.Cut(vpnIP, ",")
-			if !found {
-				return Client{}, fmt.Errorf("unable to parse line: %s", line)
+			client.VPNAddress, err = parseClientVPNAddress(line)
+			if err != nil {
+				return Client{}, err
 			}
 		case strings.HasPrefix(line, ">CLIENT:ENV,"):
 			envKey, envValue := parseClientEnv(line)
@@ -84,6 +79,25 @@ func NewClient(conf config.Config, message string) (Client, error) { //nolint:cy
 	return client, nil
 }
 
+func parseClientVPNAddress(line string) (string, error) {
+	vpnIP, found := strings.CutPrefix(line, ">CLIENT:ADDRESS,")
+	if !found {
+		return "", fmt.Errorf("unable to parse line: %s", line)
+	}
+
+	_, vpnIP, found = strings.Cut(vpnIP, ",")
+	if !found {
+		return "", fmt.Errorf("unable to parse line: %s", line)
+	}
+
+	vpnIP, _, found = strings.Cut(vpnIP, ",")
+	if !found {
+		return "", fmt.Errorf("unable to parse line: %s", line)
+	}
+
+	return vpnIP, nil
+}
+
 func parseClientEnv(line string) (string, string) {
 	comma := strings.Index(line, ",") + 1
 	key, value, ok := strings.Cut(line[comma:], "=")


Test patch:
diff --git a/internal/openvpn/connection/client_test.go b/internal/openvpn/connection/client_test.go
index 0f21677..b635162 100644
--- a/internal/openvpn/connection/client_test.go
+++ b/internal/openvpn/connection/client_test.go
@@ -24,7 +24,7 @@ func TestNewClientConnection(t *testing.T) {
 			"client CONNECT",
 			config.Defaults,
 			[]string{
-				">CLIENT:ADDRESS,127.0.1.1,1",
+				">CLIENT:ADDRESS,0,127.0.1.1,1",
 				">CLIENT:CONNECT,0,1",
 				">CLIENT:ENV,common_name=common_name",
 				">CLIENT:ENV,username=username",
Repository: aiogram/aiogram
Pull request #1602 (2024-11-02 14:29:52)

Fixed UUID (and other types) serialization in the CallbackData factory.
From now UUID will have 32 bytes length instead of 36 bytes.

github-actions[bot]: # :heavy_check_mark: Changelog found.

Thank you for adding a description of the changes

Patch:
diff --git a/CHANGES/1602.bugfix.rst b/CHANGES/1602.bugfix.rst
new file mode 100644
index 00000000..917d927c
--- /dev/null
+++ b/CHANGES/1602.bugfix.rst
@@ -0,0 +1,3 @@
+Fixed customized serialization in the :class:`aiogram.filters.callback_data.CallbackData` factory.
+
+From now UUID will have 32 bytes length instead of 36 bytes (with no `-` separators) in the callback data representation.
diff --git a/aiogram/filters/callback_data.py b/aiogram/filters/callback_data.py
index 17ccffbf..c60cd818 100644
--- a/aiogram/filters/callback_data.py
+++ b/aiogram/filters/callback_data.py
@@ -94,7 +94,7 @@ class CallbackData(BaseModel):
         :return: valid callback data for Telegram Bot API
         """
         result = [self.__prefix__]
-        for key, value in self.model_dump(mode="json").items():
+        for key, value in self.model_dump(mode="python").items():
             encoded = self._encode_value(key, value)
             if self.__separator__ in encoded:
                 raise ValueError(


Test patch:
diff --git a/tests/test_filters/test_callback_data.py b/tests/test_filters/test_callback_data.py
index 635b8e9f..8cc2f51f 100644
--- a/tests/test_filters/test_callback_data.py
+++ b/tests/test_filters/test_callback_data.py
@@ -92,6 +92,18 @@ class TestCallbackData:
 
         assert MyCallback(foo="test", bar=42).pack() == "test:test:42"
 
+    def test_pack_uuid(self):
+        class MyCallbackWithUUID(CallbackData, prefix="test"):
+            foo: str
+            bar: UUID
+
+        callback = MyCallbackWithUUID(
+            foo="test",
+            bar=UUID("123e4567-e89b-12d3-a456-426655440000"),
+        )
+
+        assert callback.pack() == "test:test:123e4567e89b12d3a456426655440000"
+
     def test_pack_optional(self):
         class MyCallback1(CallbackData, prefix="test1"):
             foo: str