nebius/SWE-bench-extra huggingface dataset:
Repository: M0r13n/pyais

Issue:
RAIM field integer in message type 4, otherwise boolean?
I've found in messages of type 4 the RAIM flag is an integer. But for other messages it is a boolean? I'm not sure if this is a bug or by design?

Comments:

Patch:
diff --git a/pyais/messages.py b/pyais/messages.py
index 07478b9..3cdd34d 100644
--- a/pyais/messages.py
+++ b/pyais/messages.py
@@ -563,7 +563,7 @@ class MessageType4(Payload):
     lat = bit_field(27, int, from_converter=from_lat_lon, to_converter=to_lat_lon, signed=True, default=0)
     epfd = bit_field(4, int, default=0, from_converter=EpfdType.from_value, to_converter=EpfdType.from_value)
     spare = bit_field(10, int, default=0)
-    raim = bit_field(1, int, default=0)
+    raim = bit_field(1, bool, default=0)
     radio = bit_field(19, int, default=0)
 
 
@@ -669,7 +669,7 @@ class MessageType9(Payload):
     dte = bit_field(1, int, default=0)
     spare = bit_field(3, int, default=0)
     assigned = bit_field(1, int, default=0)
-    raim = bit_field(1, int, default=0)
+    raim = bit_field(1, bool, default=0)
     radio = bit_field(20, int, default=0)
 
 
@@ -1297,7 +1297,7 @@ class MessageType27(Payload):
     mmsi = bit_field(30, int, from_converter=from_mmsi, to_converter=to_mmsi)
 
     accuracy = bit_field(1, int, default=0)
-    raim = bit_field(1, int, default=0)
+    raim = bit_field(1, bool, default=0)
     status = bit_field(4, int, default=0, from_converter=NavigationStatus, to_converter=NavigationStatus)
     lon = bit_field(18, int, from_converter=from_lat_lon_600, to_converter=to_lat_lon_600, default=0)
     lat = bit_field(17, int, from_converter=from_lat_lon_600, to_converter=to_lat_lon_600, default=0)


Test patch:
diff --git a/tests/test_decode.py b/tests/test_decode.py
index 8442ca3..c1ac917 100644
--- a/tests/test_decode.py
+++ b/tests/test_decode.py
@@ -101,6 +101,7 @@ class TestAIS(unittest.TestCase):
         assert msg['second'] == 34
         assert msg['maneuver'] == ManeuverIndicator.NotAvailable
         assert msg['raim']
+        assert isinstance(msg['raim'], bool)
 
     def test_msg_type_1_c(self):
         msg = decode(b"!AIVDM,1,1,,B,181:Kjh01ewHFRPDK1s3IRcn06sd,0*08").asdict()
@@ -226,6 +227,7 @@ class TestAIS(unittest.TestCase):
         assert msg['dte'] == 1
         assert msg['radio'] == 33392
         assert not msg['raim']
+        assert isinstance(msg['raim'], bool)
 
     def test_msg_type_10_a(self):
         msg = decode(b"!AIVDM,1,1,,B,:5MlU41GMK6@,0*6C").asdict()
@@ -360,6 +362,7 @@ class TestAIS(unittest.TestCase):
         assert msg['msg22'] == 1
         assert not msg['assigned']
         assert not msg['raim']
+        assert isinstance(msg['raim'], bool)
 
     def test_msg_type_19(self):
         msg = decode(b"!AIVDM,1,1,,B,C5N3SRgPEnJGEBT>NhWAwwo862PaLELTBJ:V00000000S0D:R220,0*0B").asdict()
Repository: MGough/sensorhub

Issue:
Constructor argument
Hi, thanks for this, it's nicer than the code sample provided by the manufacturer.

I've noticed that the constructor now requires a positional argument, you might want to update the README's "how to use" paragraph perhaps?

I'm using `hub = SensorHub(None)` but I'm sure there are better ways to handle that.


Comments:

Patch:
diff --git a/sensorhub/hub.py b/sensorhub/hub.py
index d1c72d8..baf98d3 100644
--- a/sensorhub/hub.py
+++ b/sensorhub/hub.py
@@ -31,7 +31,7 @@ class StatusRegisterErrorCode(Enum):
 class SensorHub:
     _bus: SMBus
 
-    def __init__(self, system_management_bus: SMBus):
+    def __init__(self, system_management_bus: SMBus = None):
         self._bus = system_management_bus or SMBus(DEVICE_BUS)
 
     def _read_sensor_board_register(self, buffer: SensorRegister) -> int:
diff --git a/setup.py b/setup.py
index 5b1420c..750c44f 100644
--- a/setup.py
+++ b/setup.py
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
 
 setuptools.setup(
     name="sensorhub",
-    version="2.0.0",
+    version="2.0.1",
     author="Merlin Gough",
     author_email="goughmerlin@gmail.com",
     description="A simple library to use with the DockerPi SensorHub (EP-0106)",


Test patch:
diff --git a/test/test_hub.py b/test/test_hub.py
index 4d639e6..bf40723 100644
--- a/test/test_hub.py
+++ b/test/test_hub.py
@@ -1,9 +1,9 @@
 from pytest import fixture, raises, mark
-from unittest.mock import call, Mock
+from unittest.mock import call, Mock, patch
 
 from smbus2 import SMBus
 
-from sensorhub.hub import SensorHub, SensorRegister
+from sensorhub.hub import SensorHub, SensorRegister, DEVICE_BUS
 
 
 @fixture
@@ -216,3 +216,12 @@ def test_barometer_pressure_returns_expected_reading(sensor_hub, bus, device_add
         call(device_address, SensorRegister.BAROMETRIC_PRESSURE_MIDDLE.value),
         call(device_address, SensorRegister.BAROMETRIC_PRESSURE_HIGH.value)
     ])
+
+
+@patch("sensorhub.hub.SMBus", autospec=True)
+def test_can_be_created_with_default_smbus(sm_bus):
+    hub = SensorHub()
+
+    assert hub._bus == sm_bus.return_value
+    sm_bus.assert_called_once_with(DEVICE_BUS)
+
Repository: Materials-Consortia/optimade-python-tools

Issue:
Queries with the form: 'value != prop' return entries where 'prop == None' 
For the trajectory endpoint, I added a few references without DOI values.
A query like [https://optimade-trajectories.herokuapp.com/v1/references?filter=%2210.1038/00000%22!=doi](https://optimade-trajectories.herokuapp.com/v1/references?filter=%2210.1038/00000%22!=doi) returned 4 entries, while the query 
[https://optimade-trajectories.herokuapp.com/v1/references?filter=doi!=%2210.1038/00000%22](https://optimade-trajectories.herokuapp.com/v1/references?filter=doi!=%2210.1038/00000%22) returns 2 entries

This also applies to other reference properties like journal and year.

Comments:

Patch:
diff --git a/optimade/filtertransformers/mongo.py b/optimade/filtertransformers/mongo.py
index d808ae8f..beba0fcd 100755
--- a/optimade/filtertransformers/mongo.py
+++ b/optimade/filtertransformers/mongo.py
@@ -141,9 +141,9 @@ class MongoTransformer(BaseTransformer):
 
     def constant_first_comparison(self, arg):
         # constant_first_comparison: constant OPERATOR ( non_string_value | not_implemented_string )
-        return {
-            arg[2]: {self.operator_map[self._reversed_operator_map[arg[1]]]: arg[0]}
-        }
+        return self.property_first_comparison(
+            arg[2], {self.operator_map[self._reversed_operator_map[arg[1]]]: arg[0]}
+        )
 
     @v_args(inline=True)
     def value_op_rhs(self, operator, value):


Test patch:
diff --git a/optimade/server/data/test_references.json b/optimade/server/data/test_references.json
index 9dd372ad..05cb7932 100644
--- a/optimade/server/data/test_references.json
+++ b/optimade/server/data/test_references.json
@@ -58,5 +58,25 @@
     "title": "Dummy reference that should remain orphaned from all structures for testing purposes",
     "journal": "JACS",
     "doi": "10.1038/00000"
+  },
+  {
+    "_id": {
+      "$oid": "98fb441f053b1744107019e3"
+    },
+    "id": "dummy/2022",
+    "last_modified": {
+      "$date": "2022-01-23T14:24:37.332Z"
+    },
+    "authors": [
+      {
+        "name": "A Nother",
+        "firstname": "A",
+        "lastname": "Nother"
+      }
+    ],
+    "year": "2019",
+    "note": "Dummy reference",
+    "title": "Just another title",
+    "journal": "JACS"
   }
 ]
diff --git a/tests/filtertransformers/test_mongo.py b/tests/filtertransformers/test_mongo.py
index cf40440e..fec8c2c8 100644
--- a/tests/filtertransformers/test_mongo.py
+++ b/tests/filtertransformers/test_mongo.py
@@ -888,3 +888,8 @@ class TestMongoTransformer:
                 {"number": {"$eq": 0.0}},
             ]
         }
+
+    def test_constant_first_comparisson(self):
+        assert self.transform("nelements != 5") == self.transform("5 != nelements")
+        assert self.transform("nelements > 5") == self.transform("5 < nelements")
+        assert self.transform("nelements <= 5") == self.transform("5 >= nelements")
Repository: MicroPyramid/forex-python

Issue:
identity get_rate
It would be nice that the conversion from one currency to itself also work
```
>>> c.get_rate("CHF", "CHF")
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/home/user/.virtualenvs/tool/local/lib/python2.7/site-packages/forex_python/converter.py", line 67, in get_rate
    base_cur, dest_cur, date_str))
RatesNotAvailableError: Currency Rate CHF => CHF not available for Date latest
```

Comments:

Patch:
diff --git a/forex_python/converter.py b/forex_python/converter.py
index bcc8348..316f0cf 100644
--- a/forex_python/converter.py
+++ b/forex_python/converter.py
@@ -56,6 +56,8 @@ class CurrencyRates(Common):
         raise RatesNotAvailableError("Currency Rates Source Not Ready")
 
     def get_rate(self, base_cur, dest_cur, date_obj=None):
+        if base_cur == dest_cur:
+            return 1.
         date_str = self._get_date_string(date_obj)
         payload = {'base': base_cur, 'symbols': dest_cur}
         source_url = self._source_url() + date_str


Test patch:
diff --git a/tests/test.py b/tests/test.py
index 040ed75..2501aa9 100644
--- a/tests/test.py
+++ b/tests/test.py
@@ -50,6 +50,11 @@ class TestGetRate(TestCase):
 
         # check if return value is float
         self.assertTrue(isinstance(rate, float))
+    
+    def test_get_rate_with_valid_codes_same_currency(self):
+        rate = get_rate('USD', 'USD')
+        # rate should be 1.
+        self.assertEqual(1., rate)
 
     def test_get_rate_with_date(self):
         date_obj = datetime.datetime.strptime('2010-05-10', "%Y-%m-%d").date()