nebius/SWE-bench-extra huggingface dataset:
Repository: nutechsoftware/alarmdecoder

Issue:
Communicator failures not handled
Messages such as this lead to failures when updating zones:
```
May 12 10:08:59 [00000001000000000A--],0fc,[f704009f10fc000008020000000000],"COMM. FAILURE                   "
May 12 10:09:03 [00000001000000100A--],0bf,[f704009f10bf000208020000000000],"CHECK 103 LngRngRadio       0000"
```
```
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/site-packages/alarmdecoder/devices/base_device.py", line 148, in run
    self._device.read_line(timeout=self.READ_TIMEOUT)
  File "/usr/local/lib/python3.8/site-packages/alarmdecoder/devices/socket_device.py", line 356, in read_line
    self.on_read(data=ret)
  File "/usr/local/lib/python3.8/site-packages/alarmdecoder/event/event.py", line 84, in fire
    func(self.obj, *args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/alarmdecoder/decoder.py", line 1041, in _on_read
    self._handle_message(data)
  File "/usr/local/lib/python3.8/site-packages/alarmdecoder/decoder.py", line 439, in _handle_message
    msg = self._handle_keypad_message(data)
  File "/usr/local/lib/python3.8/site-packages/alarmdecoder/decoder.py", line 481, in _handle_keypad_message
    self._update_internal_states(msg)
  File "/usr/local/lib/python3.8/site-packages/alarmdecoder/decoder.py", line 632, in _update_internal_states
    self._update_zone_tracker(message)
  File "/usr/local/lib/python3.8/site-packages/alarmdecoder/decoder.py", line 1017, in _update_zone_tracker
    self._zonetracker.update(message)
  File "/usr/local/lib/python3.8/site-packages/alarmdecoder/zonetracking.py", line 209, in update
    self._zones_faulted.sort()
TypeError: '<' not supported between instances of 'str' and 'int'
```

Comments:

Patch:
diff --git a/alarmdecoder/zonetracking.py b/alarmdecoder/zonetracking.py
index 13be3c3..ae92eb7 100644
--- a/alarmdecoder/zonetracking.py
+++ b/alarmdecoder/zonetracking.py
@@ -189,7 +189,7 @@ class Zonetracker(object):
                     if match is None:
                         return
 
-                    zone = match.group(1)
+                    zone = int(match.group(1))
 
                 # Add new zones and clear expired ones.
                 if zone in self._zones_faulted:


Test patch:
diff --git a/test/test_zonetracking.py b/test/test_zonetracking.py
index 6d8f087..0156871 100644
--- a/test/test_zonetracking.py
+++ b/test/test_zonetracking.py
@@ -76,7 +76,7 @@ class TestZonetracking(TestCase):
         msg = Message('[00000000000000100A--],0bf,[f707000600e5800c0c020000],"CHECK 1                         "')
         self._zonetracker.update(msg)
 
-        self.assertEqual(self._zonetracker._zones['1'].status, Zone.CHECK)
+        self.assertEqual(self._zonetracker._zones[1].status, Zone.CHECK)
 
     def test_zone_restore_skip(self):
         panel_messages = [
Repository: nylas/nylas-python

Issue:
Allow users to pass `state` during authentication

Comments:

Patch:
diff --git a/nylas/client/client.py b/nylas/client/client.py
index 8278ae5..b41f782 100644
--- a/nylas/client/client.py
+++ b/nylas/client/client.py
@@ -143,13 +143,13 @@ class APIClient(json.JSONEncoder):
             if 'Authorization' in self.session.headers:
                 del self.session.headers['Authorization']
 
-    def authentication_url(self, redirect_uri, login_hint=''):
+    def authentication_url(self, redirect_uri, login_hint='', state=''):
         args = {'redirect_uri': redirect_uri,
                 'client_id': self.app_id or 'None',  # 'None' for back-compat
                 'response_type': 'code',
                 'scope': 'email',
                 'login_hint': login_hint,
-                'state': ''}
+                'state': state}
 
         url = URLObject(self.authorize_url).add_query_params(args.items())
         return str(url)


Test patch:
diff --git a/tests/test_client.py b/tests/test_client.py
index 8a8590d..ea4831d 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -83,6 +83,12 @@ def test_client_authentication_url(api_client, api_url):
     expected2 = expected.set_query_param("login_hint", "hint")
     assert urls_equal(expected2, actual2)
 
+    actual3 = URLObject(
+        api_client.authentication_url("/redirect", state="confusion")
+    )
+    expected3 = expected.set_query_param("state", "confusion")
+    assert urls_equal(expected3, actual3)
+
 
 @responses.activate
 def test_client_token_for_code(api_client, api_url):