nebius/SWE-bench-extra huggingface dataset:
Repository: aio-libs/aioftp

Issue:
`parse_ls_date` doesn't handle singe-spaced servers.
I'm using aioftp across a multitude of FTP servers, and just discovered that one of them uses a timestamp of `%b %d %Y` instead of `%b %d  %Y`.
Because the parser assumes the date is exactly 12 characters long, it will catch `Jan 03 2018` as `Jan 03 2018 `. This in turn leads to a datetime parsing error.

Comments:

Patch:
diff --git a/aioftp/client.py b/aioftp/client.py
index a1072b6..566a397 100644
--- a/aioftp/client.py
+++ b/aioftp/client.py
@@ -360,7 +360,7 @@ class BaseClient:
     def parse_ls_date(cls, s, *, now=None):
         """
         Parsing dates from the ls unix utility. For example,
-        "Nov 18  1958" and "Nov 18 12:29".
+        "Nov 18  1958", "Jan 03 2018", and "Nov 18 12:29".
 
         :param s: ls date
         :type s: :py:class:`str`
@@ -439,7 +439,7 @@ class BaseClient:
             raise ValueError
 
         s = s[i:].lstrip()
-        info["modify"] = self.parse_ls_date(s[:12])
+        info["modify"] = self.parse_ls_date(s[:12].strip())
         s = s[12:].strip()
         if info["type"] == "link":
             i = s.rindex(" -> ")
diff --git a/history.rst b/history.rst
index 20ea7de..a78574f 100644
--- a/history.rst
+++ b/history.rst
@@ -1,6 +1,9 @@
 x.x.x (xx-xx-xxxx)
 ------------------
 
+- client: strip date before parsing (#113)
+Thanks to `ndhansen <https://github.com/ndhansen>`_
+
 0.16.0 (11-03-2020)
 ------------------
 


Test patch:
diff --git a/tests/test_simple_functions.py b/tests/test_simple_functions.py
index cada55a..e46448b 100644
--- a/tests/test_simple_functions.py
+++ b/tests/test_simple_functions.py
@@ -165,6 +165,8 @@ def test_parse_list_line_unix():
         ],
         "dir": [
             "drw-rw-r--  1 poh  poh   6595 Feb 27 04:14 history.rst",
+            "drw-rw-r--  1 poh  poh   6595 Jan 03 2016  changes.rst",
+            "drw-rw-r--  1 poh  poh   6595 Mar 10  1996 README.rst",
         ],
         "unknown": [
             "Erw-rw-r--  1 poh  poh   6595 Feb 27 04:14 history.rst",
Repository: aio-libs/multidict

Issue:
Python MultiDict constructor discards generator content
When using the pure Python implementation, if a `MultiDict` is constructed with a generator argument:

    headers = CIMultiDict(
        (
            k.decode('utf-8', 'surrogateescape'),
            v.decode('utf-8', 'surrogateescape'),
        )
        for k, v in event.headers
    )

then the resulting `MultiDict` will be empty, instead of containing the key/value pairs as expected. This is because the generator is iterated over twice, and the first iteration discards all of the pairs.

Comments:

Patch:
diff --git a/multidict/_multidict_py.py b/multidict/_multidict_py.py
index f9c8f38..bff8276 100644
--- a/multidict/_multidict_py.py
+++ b/multidict/_multidict_py.py
@@ -185,12 +185,13 @@ class MultiDict(_Base, abc.MutableMapping):
             elif hasattr(arg, 'items'):
                 items = arg.items()
             else:
+                items = []
                 for item in arg:
                     if not len(item) == 2:
                         raise TypeError(
                             "{} takes either dict or list of (key, value) "
                             "tuples".format(name))
-                items = arg
+                    items.append(item)
 
             for key, value in items:
                 method(key, value)


Test patch:
diff --git a/tests/test_multidict.py b/tests/test_multidict.py
index 8fa6e78..268a26e 100644
--- a/tests/test_multidict.py
+++ b/tests/test_multidict.py
@@ -73,6 +73,15 @@ class _BaseTest(_Root):
         self.assertEqual(sorted(d.items()), [('key', 'value1'),
                                              ('key2', 'value2')])
 
+    def test_instantiate__from_generator(self):
+        d = self.make_dict((str(i), i) for i in range(2))
+
+        self.assertEqual(d, {'0': 0, '1': 1})
+        self.assertEqual(len(d), 2)
+        self.assertEqual(sorted(d.keys()), ['0', '1'])
+        self.assertEqual(sorted(d.values()), [0, 1])
+        self.assertEqual(sorted(d.items()), [('0', 0), ('1', 1)])
+
     def test_getone(self):
         d = self.make_dict([('key', 'value1')], key='value2')
         self.assertEqual(d.getone('key'), 'value1')
Repository: aio-libs/yarl

Issue:
`if type(val) is str` is a bit too strict
It makes sense to use a subclass of str for example if I want to put a secret into a class but want to censor the repr: https://github.com/hynek/environ_config/blob/69b1c8ab25fde3c20fa21de1a044e30760c86d36/src/environ/secrets.py#L114-L124

This breaks with the latest versions.

Comments:

Patch:
diff --git a/CHANGES.rst b/CHANGES.rst
index 5fa41b2..a6d5665 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,6 +1,11 @@
 CHANGES
 =======
 
+1.2.3 (2018-05-03)
+------------------
+
+* Accept `str` subclasses in `URL` constructor (#190)
+
 1.2.2 (2018-05-01)
 ------------------
 
diff --git a/appveyor.yml b/appveyor.yml
index a0f7c19..a8dc45f 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -4,9 +4,6 @@ environment:
   PYPI_PASSWD:
     secure: u+K6dKi7+CXXVFEUG4V7zUyV3w7Ntg0Ork/RGVV0eSQ=
   matrix:
-    - PYTHON: "C:\\Python34"
-    - PYTHON: "C:\\Python34-x64"
-      DISTUTILS_USE_SDK: "1"
     - PYTHON: "C:\\Python35"
     - PYTHON: "C:\\Python35-x64"
     - PYTHON: "C:\\Python36"
diff --git a/yarl/__init__.py b/yarl/__init__.py
index ddeeb40..13340c6 100644
--- a/yarl/__init__.py
+++ b/yarl/__init__.py
@@ -151,6 +151,8 @@ class URL:
         elif type(val) is SplitResult:
             if not encoded:
                 raise ValueError("Cannot apply decoding to SplitResult")
+        elif isinstance(val, str):
+            val = urlsplit(str(val))
         else:
             raise TypeError("Constructor parameter should be str")
 


Test patch:
diff --git a/tests/test_url.py b/tests/test_url.py
index a12e25b..598e0fd 100644
--- a/tests/test_url.py
+++ b/tests/test_url.py
@@ -17,6 +17,13 @@ def test_inheritance():
             "from URL is forbidden" == str(ctx.value))
 
 
+def test_str_subclass():
+    class S(str):
+        pass
+
+    assert str(URL(S('http://example.com'))) == 'http://example.com'
+
+
 def test_is():
     u1 = URL('http://example.com')
     u2 = URL(u1)