nebius/SWE-bench-extra huggingface dataset:
Repository: Erotemic/ubelt

Issue:
Request: ensure director verbose mentions if it created a new directory
It would be nice if the verbose mode actually said something like 
Ensuring directory ('...') status: existing
Ensuring directory ('...') status: creating

Maybe have a second verbose level if you want to maintain the original way.  

Comments:

Patch:
diff --git a/ubelt/util_path.py b/ubelt/util_path.py
index c028ba2..5241209 100644
--- a/ubelt/util_path.py
+++ b/ubelt/util_path.py
@@ -291,9 +291,9 @@ def ensuredir(dpath, mode=0o1777, verbose=None, recreate=False):
         >>> assert exists(dpath)
         >>> os.rmdir(dpath)
     """
-    if verbose is None:  # nocover
+    if verbose is None:
         verbose = 0
-    if isinstance(dpath, (list, tuple)):  # nocover
+    if isinstance(dpath, (list, tuple)):
         dpath = join(*dpath)
 
     if recreate:
@@ -301,15 +301,15 @@ def ensuredir(dpath, mode=0o1777, verbose=None, recreate=False):
         ub.delete(dpath, verbose=verbose)
 
     if not exists(dpath):
-        if verbose:  # nocover
-            print('Ensuring new directory (%r)' % dpath)
+        if verbose:
+            print('Ensuring directory (creating {!r})'.format(dpath))
         if sys.version_info.major == 2:  # nocover
             os.makedirs(normpath(dpath), mode=mode)
         else:
             os.makedirs(normpath(dpath), mode=mode, exist_ok=True)
     else:
-        if verbose:  # nocover
-            print('Ensuring existing directory (%r)' % dpath)
+        if verbose:
+            print('Ensuring directory (existing {!r})'.format(dpath))
     return dpath
 
 


Test patch:
diff --git a/tests/test_path.py b/tests/test_path.py
index 49ea0c8..fafadd2 100644
--- a/tests/test_path.py
+++ b/tests/test_path.py
@@ -55,8 +55,31 @@ def test_augpath_dpath():
 
 
 def test_ensuredir_recreate():
-    ub.ensuredir('foo', recreate=True)
-    ub.ensuredir('foo/bar')
-    assert exists('foo/bar')
-    ub.ensuredir('foo', recreate=True)
-    assert not exists('foo/bar')
+    base = ub.ensure_app_cache_dir('ubelt/tests')
+    folder = join(base, 'foo')
+    member = join(folder, 'bar')
+    ub.ensuredir(folder, recreate=True)
+    ub.ensuredir(member)
+    assert exists(member)
+    ub.ensuredir(folder, recreate=True)
+    assert not exists(member)
+
+
+def test_ensuredir_verbosity():
+    base = ub.ensure_app_cache_dir('ubelt/tests')
+
+    with ub.CaptureStdout() as cap:
+        ub.ensuredir(join(base, 'foo'), verbose=0)
+    assert cap.text == ''
+    # None defaults to verbose=0
+    with ub.CaptureStdout() as cap:
+        ub.ensuredir((base, 'foo'), verbose=None)
+    assert cap.text == ''
+
+    ub.delete(join(base, 'foo'))
+    with ub.CaptureStdout() as cap:
+        ub.ensuredir(join(base, 'foo'), verbose=1)
+    assert 'creating' in cap.text
+    with ub.CaptureStdout() as cap:
+        ub.ensuredir(join(base, 'foo'), verbose=1)
+    assert 'existing' in cap.text
Repository: Eyepea/aiosip

Issue:
Improper handling of 401 authentication failures
In a call flow such as

* send REGISTER 
* get 401 response with auth challenge
* send REGISTER with valid authentication
* get 401 response with no challenge (ie: your credentials are fine, but still denied)

The client will continue to retransmit the request with the authorization header 

Comments:

Patch:
diff --git a/aiosip/transaction.py b/aiosip/transaction.py
index da61942..4f2b0ab 100644
--- a/aiosip/transaction.py
+++ b/aiosip/transaction.py
@@ -145,6 +145,9 @@ class FutureTransaction(BaseTransaction):
         self.dialog.end_transaction(self)
 
     def _result(self, msg):
+        if self.authentification:
+            self.authentification.cancel()
+            self.authentification = None
         self._future.set_result(msg)
         self.dialog.end_transaction(self)
 


Test patch:
diff --git a/tests/test_sip_scenario.py b/tests/test_sip_scenario.py
index d38e7c3..fdb1a89 100644
--- a/tests/test_sip_scenario.py
+++ b/tests/test_sip_scenario.py
@@ -92,6 +92,53 @@ async def test_authentication(test_server, protocol, loop, from_details, to_deta
     await app.close()
 
 
+async def test_authentication_rejection(test_server, protocol, loop, from_details, to_details):
+    received_messages = list()
+
+    class Dialplan(aiosip.BaseDialplan):
+
+        async def resolve(self, *args, **kwargs):
+            await super().resolve(*args, **kwargs)
+            return self.subscribe
+
+        async def subscribe(self, request, message):
+            dialog = request._create_dialog()
+
+            received_messages.append(message)
+            await dialog.unauthorized(message)
+
+            async for message in dialog:
+                received_messages.append(message)
+                await dialog.reply(message, 401)
+
+    app = aiosip.Application(loop=loop)
+    server_app = aiosip.Application(loop=loop, dialplan=Dialplan())
+    server = await test_server(server_app)
+
+    peer = await app.connect(
+        protocol=protocol,
+        remote_addr=(
+            server.sip_config['server_host'],
+            server.sip_config['server_port'],
+        )
+    )
+
+    result = await peer.register(
+        expires=1800,
+        from_details=aiosip.Contact.from_header(from_details),
+        to_details=aiosip.Contact.from_header(to_details),
+        password='testing_pass',
+    )
+
+    # wait long enough to ensure no improper retransmit
+    await asyncio.sleep(1)
+    assert len(received_messages) == 2
+    assert result.status_code == 401
+
+    await server_app.close()
+    await app.close()
+
+
 async def test_invite(test_server, protocol, loop, from_details, to_details):
     call_established = loop.create_future()
     call_disconnected = loop.create_future()