PrimeIntellect/SWE-rebench-V2-Filtered-Easy-Verified huggingface dataset:
Repository: FHIR/sushi (ts)
Issue: No easy way to put a caret rule on the root element
Sometimes authors might want to assign a `short` description on the root element.  Usually our syntax for setting a short on an element is:
```
* path ^short = "My short description"
```
For the root element, there is no path -- but if we leave it blank, it's interpreted as being on the SD itself (not the root element).

This *might* work if you do:
```
* ^snapshot.element.short = "My short description"
```
but honestly, I'm not sure due to the way we do elements in the `StructureDefinition` class.

At a minimum, we should ensure the workaround works, but ideally we should define a syntax to access the root element.
Pull request description: Apply CaretValueRule to parent element with .
Fixes #277 and completes task https://standardhealthrecord.atlassian.net/browse/CIMPL-313

When a path of "." is used in a CaretValueRule, the rule is applied to the parent element in the structure definition. This is distinct from an empty path "", where the rule is applied to the structure definition itself.

Patch:
diff --git a/src/fhirtypes/StructureDefinition.ts b/src/fhirtypes/StructureDefinition.ts
index 8b556da..fe34241 100644
--- a/src/fhirtypes/StructureDefinition.ts
+++ b/src/fhirtypes/StructureDefinition.ts
@@ -173,7 +173,7 @@ export class StructureDefinition {
   findElementByPath(path: string, fisher: Fishable): ElementDefinition {
     // If the path already exists, get it and return the match
     // If !path just return the base parent element
-    const fullPath = path ? `${this.type}.${path}` : this.type;
+    const fullPath = path && path !== '.' ? `${this.type}.${path}` : this.type;
     const match = this.elements.find(e => e.path === fullPath && !e.id.includes(':'));
     if (match != null) {
       return match;


Test patch:
diff --git a/test/export/StructureDefinitionExporter.test.ts b/test/export/StructureDefinitionExporter.test.ts
index f94c35e..b672d1d 100644
--- a/test/export/StructureDefinitionExporter.test.ts
+++ b/test/export/StructureDefinitionExporter.test.ts
@@ -1930,6 +1930,24 @@ describe('StructureDefinitionExporter', () => {
     expect(loggerSpy.getLastMessage()).toMatch(/File: InvalidValue\.fsh.*Line: 6\D*/s);
   });
 
+  it('should apply a CaretValueRule on the parent element', () => {
+    // Profile: ShortObservation
+    // Parent: Observation
+    // * . ^ short = "This one is not so tall."
+    const profile = new Profile('ShortObservation');
+    profile.parent = 'Observation';
+
+    const rule = new CaretValueRule('.');
+    rule.caretPath = 'short';
+    rule.value = 'This one is not so tall.';
+    profile.rules.push(rule);
+
+    exporter.exportStructDef(profile);
+    const sd = pkg.profiles[0];
+    const observation = sd.findElement('Observation');
+    expect(observation.short).toBe('This one is not so tall.');
+  });
+
   it('should apply a CaretValueRule on an element without a path', () => {
     const profile = new Profile('Foo');
     profile.parent = 'Observation';
Repository: OpenMined/PySyft (python)
Issue: Fix precision with large storage fails
**Describe the bug**
The following operation fails

`lpt = torch.Tensor([-2., 4]).fix_prec(storage="large")`

**To Reproduce**
Steps to reproduce the behavior:
Use the above expression in a test and see the result:
`TypeError`
**Expected behavior**
The expression should not crash
**Screenshots**

**Desktop (please complete the following information):**

**Additional context**

Pull request description: Fix TypeError when doing remainder
When performing remainder operation with floats and a large field numpy was throwing a `TypeError` exception.

This issue explains how to fix it

numpy/numpy#6464

Closes #2604

Patch:
diff --git a/syft/frameworks/torch/tensors/interpreters/large_precision.py b/syft/frameworks/torch/tensors/interpreters/large_precision.py
index f836022c4e..bbc46e6b7f 100644
--- a/syft/frameworks/torch/tensors/interpreters/large_precision.py
+++ b/syft/frameworks/torch/tensors/interpreters/large_precision.py
@@ -74,7 +74,8 @@ class LargePrecisionTensor(AbstractTensor):
 
         # floor is applied otherwise, long float is not accurate
         self_scaled = np.vectorize(math.floor)(self_scaled)
-        self_scaled %= self.field
+        # https://github.com/numpy/numpy/issues/6464
+        self_scaled = np.remainder(self_scaled, np.array(self.field), casting="unsafe")
 
         # self_scaled can be an array of floats. As multiplying an array of int with an int
         # still gives an array of int, I think it should be because self.child is a float tensor at this point.


Test patch:
diff --git a/test/torch/tensors/test_large_precision.py b/test/torch/tensors/test_large_precision.py
index 74dc415f37..6eabf814f6 100644
--- a/test/torch/tensors/test_large_precision.py
+++ b/test/torch/tensors/test_large_precision.py
@@ -283,6 +283,14 @@ def test_share_sub(workers):
     assert torch.all(torch.eq(expected, y))
 
 
+def test_storage():
+    x = torch.tensor([1.0, 2.0, 3.0])
+    enlarged = x.fix_prec(storage="large")
+    restored = enlarged.float_precision()
+    # And now x and restored must be the same
+    assert torch.all(torch.eq(x, restored))
+
+
 # def test_share_mul(workers):
 #     alice, bob, james = (workers["alice"], workers["bob"], workers["james"])
 #
Repository: seanmonstar/reqwest (rust)
Issue: Regression: Error::url returns None in 0.12.16
The following code succeeds in 0.12.15, but fails in 0.12.16:

```rs
#[tokio::main]
async fn main() {
    let err = reqwest::get("https://fake.url").await.unwrap_err(); // also: http://localhost
    assert!(err.url().is_some());
}
```

I have narrowed it down to commit d9cf60e, it fails there but succeeds in the parent commit 75f62f2.

The context of this use case is a client that can connect to both a local dev server and a remote server, and displaying an error message saying to start the dev server if a connection fails to localhost in particular, rather than displaying a network error.
Pull request description: fix: request errors should include url
Closes #2740 

Patch:
diff --git a/src/async_impl/client.rs b/src/async_impl/client.rs
index 13e4c33..936bdd4 100644
--- a/src/async_impl/client.rs
+++ b/src/async_impl/client.rs
@@ -3020,7 +3020,7 @@ impl Future for PendingRequest {
                             }
                         }
 
-                        return Poll::Ready(Err(e));
+                        return Poll::Ready(Err(e.if_no_url(|| self.url.clone())));
                     }
                     Poll::Ready(Ok(res)) => res.map(super::body::boxed),
                     Poll::Pending => return Poll::Pending,
diff --git a/src/error.rs b/src/error.rs
index d67d5ce..e893be5 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -76,6 +76,13 @@ impl Error {
         self
     }
 
+    pub(crate) fn if_no_url(mut self, f: impl FnOnce() -> Url) -> Self {
+        if self.inner.url.is_none() {
+            self.inner.url = Some(f());
+        }
+        self
+    }
+
     /// Strip the related url from this error (if, for example, it contains
     /// sensitive information)
     pub fn without_url(mut self) -> Self {


Test patch:
diff --git a/tests/client.rs b/tests/client.rs
index 3ae438e..307892c 100644
--- a/tests/client.rs
+++ b/tests/client.rs
@@ -593,3 +593,10 @@ async fn http1_reason_phrase() {
         )
     );
 }
+
+#[tokio::test]
+async fn error_has_url() {
+    let u = "http://does.not.exist.local/ever";
+    let err = reqwest::get(u).await.unwrap_err();
+    assert_eq!(err.url().map(AsRef::as_ref), Some(u), "{err:?}");
+}