PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: kmyk/online-judge-tools (python)
Issue: Dispatch API raises assertion error?
Some classes `raises` AssertionError if parse is not succeeded.
But should we always return `None` when URL is invalid? Since such inputs are possible in user applications.
```python
>>> dispatch.problem_from_url("https://yukicoder.me/contests/241/")  # Assert raises
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ryo/workspace/github/online-judge-tools/onlinejudge/dispatch.py", line 53, in problem_from_url
    problem = cls.from_url(url)
  File "/home/ryo/workspace/github/online-judge-tools/onlinejudge/service/yukicoder.py", line 359, in from_url
    return cls()
  File "/home/ryo/workspace/github/online-judge-tools/onlinejudge/service/yukicoder.py", line 238, in __init__
    assert problem_no or problem_id
AssertionError
>>> dispatch.problem_from_url("https://yahoo.co.jp")  # return None

```
Pull request description: Issue/578/yukicoder
Resolve #578

Patch:
diff --git a/onlinejudge/service/yukicoder.py b/onlinejudge/service/yukicoder.py
index 7923c33..584b79e 100644
--- a/onlinejudge/service/yukicoder.py
+++ b/onlinejudge/service/yukicoder.py
@@ -353,10 +353,9 @@ class YukicoderProblem(onlinejudge.type.Problem):
                 pass
             if n is not None:
                 if dirname == '/problems/no':
-                    return cls(problem_no=int(n))
+                    return cls(problem_no=n)
                 if dirname == '/problems':
-                    return cls(problem_id=int(n))
-            return cls()
+                    return cls(problem_id=n)
         return None
 
     def get_service(self) -> YukicoderService:


Test patch:
diff --git a/tests/dispatch.py b/tests/dispatch.py
index e532754..bd71a3c 100644
--- a/tests/dispatch.py
+++ b/tests/dispatch.py
@@ -58,6 +58,7 @@ class DispatchCodeForcesTest(unittest.TestCase):
 class InvalidDispatchTest(unittest.TestCase):
     def test_problem_from_url(self):
         self.assertIsNone(dispatch.problem_from_url('https://atcoder.jp/contests/agc039'))
+        self.assertIsNone(dispatch.problem_from_url("https://yukicoder.me/contests/241/"))
 
     def test_submission_from_url(self):
         self.assertIsNone(dispatch.submission_from_url('https://atcoder.jp/contests/agc039'))