nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: 99designs/gqlgen
Pull request #3153 (2024-06-22 06:21:16)

fix bug: POST transport Insufficient rigorous judgment leads to invalid SSE transport
fix bug: POST transfer judgment was not strict enough, resulting in SSE transport never will be invoked

For example, the following POST based SSE request will be automatically taken over by POST transport and will not enter the SSE process

```
curl -N --request POST --url http://localhost:8080/query \
--data '{"query":"subscription { currentTime { unixTime timeStamp } }"}' \
-H "accept: text/event-stream" -H 'content-type: application/json' \
--verbose
```

Easy bug fixes, without updating documentation

I have:
 - [x] Added tests covering the bug / feature (see [testing](https://github.com/99designs/gqlgen/blob/master/TESTING.md))
 - [ ] Updated any relevant documentation (see [docs](https://github.com/99designs/gqlgen/tree/master/docs/content))

coveralls: 
[![Coverage Status](https://coveralls.io/builds/68239556/badge)](https://coveralls.io/builds/68239556)

coverage: 74.663% (+0.008%) from 74.655%
when pulling **448da58064d6a9a32b20e0c2e1c6d9b9416930c7 on o8x:master**
into **7c8bc50dfe6b46b840418276fb193b711066742c on 99designs:master**.

StevenACoffman: Hey, thank you very much! By the way, many users have asked me if there's a public repository that demonstrates using HTTP SSE with GraphQL. Are you able to make one public?

Patch:
diff --git a/graphql/handler/transport/http_post.go b/graphql/handler/transport/http_post.go
index 985f8db2..085f60a9 100644
--- a/graphql/handler/transport/http_post.go
+++ b/graphql/handler/transport/http_post.go
@@ -27,6 +27,10 @@ func (h POST) Supports(r *http.Request) bool {
 		return false
 	}
 
+	if strings.Contains(r.Header.Get("Accept"), "text/event-stream") {
+		return false
+	}
+
 	mediaType, _, err := mime.ParseMediaType(r.Header.Get("Content-Type"))
 	if err != nil {
 		return false


Test patch:
diff --git a/graphql/handler/transport/http_post_test.go b/graphql/handler/transport/http_post_test.go
index 97ef3be6..28095d85 100644
--- a/graphql/handler/transport/http_post_test.go
+++ b/graphql/handler/transport/http_post_test.go
@@ -96,6 +96,22 @@ func TestPOST(t *testing.T) {
 			})
 		}
 	})
+
+	t.Run("validate SSE", func(t *testing.T) {
+		doReq := func(handler http.Handler, method string, target string, body string) *httptest.ResponseRecorder {
+			r := httptest.NewRequest(method, target, strings.NewReader(body))
+			r.Header.Set("Content-Type", "application/json")
+			r.Header.Set("Accept", "text/event-stream")
+			w := httptest.NewRecorder()
+
+			handler.ServeHTTP(w, r)
+			return w
+		}
+
+		resp := doReq(h, "POST", "/graphql", `{"query":"{ name }"}`)
+		assert.Equal(t, http.StatusBadRequest, resp.Code, resp.Body.String())
+		assert.Equal(t, `{"errors":[{"message":"transport not supported"}],"data":null}`, resp.Body.String())
+	})
 }
 
 func doRequest(handler http.Handler, method, target, body, contentType string) *httptest.ResponseRecorder {
Repository: mikedh/trimesh
Pull request #1501 (2022-02-22 17:39:21)

Release: Quad Texture Fix
- release #1500


Patch:
diff --git a/models/plane.ply b/models/plane.ply
new file mode 100644
index 00000000..df85e50d
--- /dev/null
+++ b/models/plane.ply
@@ -0,0 +1,20 @@
+ply
+format ascii 1.0
+comment Created by Blender 2.82 (sub 7) - www.blender.org, source file: ''
+element vertex 4
+property float x
+property float y
+property float z
+property float nx
+property float ny
+property float nz
+property float s
+property float t
+element face 1
+property list uchar uint vertex_indices
+end_header
+-1.000000 -1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000
+1.000000 -1.000000 0.000000 0.000000 0.000000 1.000000 1.000000 0.000000
+1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 1.000000 1.000000
+-1.000000 1.000000 0.000000 0.000000 0.000000 1.000000 0.000000 1.000000
+4 0 1 2 3
diff --git a/models/plane_tri.ply b/models/plane_tri.ply
new file mode 100644
index 00000000..037f390b
--- /dev/null
+++ b/models/plane_tri.ply
@@ -0,0 +1,21 @@
+ply
+format ascii 1.0
+comment Created by Blender 2.82 (sub 7) - www.blender.org, source file: ''
+element vertex 4
+property float x
+property float y
+property float z
+property float nx
+property float ny
+property float nz
+property float s
+property float t
+element face 2
+property list uchar uint vertex_indices
+end_header
+1.000000 -1.000000 0.000000 -0.000000 0.000000 1.000000 1.000000 0.000000
+-1.000000 1.000000 0.000000 -0.000000 0.000000 1.000000 0.000000 1.000000
+-1.000000 -1.000000 0.000000 -0.000000 0.000000 1.000000 0.000000 0.000000
+1.000000 1.000000 0.000000 -0.000000 0.000000 1.000000 1.000000 1.000000
+3 0 1 2
+3 0 3 1
diff --git a/trimesh/version.py b/trimesh/version.py
index e88098e3..33fc5280 100644
--- a/trimesh/version.py
+++ b/trimesh/version.py
@@ -1,1 +1,1 @@
-__version__ = '3.10.1'
+__version__ = '3.10.2'
diff --git a/trimesh/visual/texture.py b/trimesh/visual/texture.py
index f783a578..ea5056f7 100644
--- a/trimesh/visual/texture.py
+++ b/trimesh/visual/texture.py
@@ -311,7 +311,7 @@ def unmerge_faces(faces, *args, **kwargs):
     remap[order] = np.arange(len(order))
 
     # the faces are just the inverse with the new order
-    new_faces = remap[inverse].reshape((-1, 3))
+    new_faces = remap[inverse].reshape((-1, faces.shape[1]))
 
     # the mask for vertices and masks for other args
     result = [new_faces]


Test patch:
diff --git a/tests/test_ply.py b/tests/test_ply.py
index 8167492a..baca2512 100644
--- a/tests/test_ply.py
+++ b/tests/test_ply.py
@@ -198,6 +198,13 @@ class PlyTest(g.unittest.TestCase):
             assert hasattr(m, 'visual') and hasattr(m.visual, 'uv')
             assert m.visual.uv.shape[0] == m.vertices.shape[0]
 
+    def test_fix_texture(self):
+        # test loading of face indices when uv-coordinates are also contained
+        m1 = g.get_mesh('plane.ply')
+        m2 = g.get_mesh('plane_tri.ply')
+        assert m1.faces.shape == (2, 3)
+        assert m2.faces.shape == (2, 3)
+
 
 if __name__ == '__main__':
     g.trimesh.util.attach_to_log()
Repository: mikedh/trimesh
Pull request #1537 (2022-03-28 23:13:46)

Export MTL file for obj meshes even if they don't have uv coordinates
Addresses #1518 


Patch:
diff --git a/trimesh/exchange/obj.py b/trimesh/exchange/obj.py
index e5dccd1e..34b65e68 100644
--- a/trimesh/exchange/obj.py
+++ b/trimesh/exchange/obj.py
@@ -851,7 +851,7 @@ def export_obj(mesh,
                 log.debug('failed to convert vertex normals',
                           exc_info=True)
 
-        if include_texture and len(np.shape(getattr(mesh.visual, 'uv', None))) == 2:
+        if include_texture and hasattr(mesh.visual, 'uv'):
             try:
                 material = mesh.visual.material
                 if hasattr(material, 'to_simple'):
@@ -859,15 +859,18 @@ def export_obj(mesh,
                 (tex_data,
                  tex_name,
                  mtl_name) = material.to_obj()
-                converted = util.array_to_string(
-                    mesh.visual.uv,
-                    col_delim=' ',
-                    row_delim='\nvt ',
-                    digits=digits)
-                # if vertex texture exists and is the right shape
-                face_type.append('vt')
-                # add the uv coordinates
-                export.append('vt ' + converted)
+
+                if len(np.shape(getattr(mesh.visual, 'uv', None))) == 2:
+                    converted = util.array_to_string(
+                        mesh.visual.uv,
+                        col_delim=' ',
+                        row_delim='\nvt ',
+                        digits=digits)
+                    # if vertex texture exists and is the right shape
+                    face_type.append('vt')
+                    # add the uv coordinates
+                    export.append('vt ' + converted)
+
                 # add the reference to the MTL file
                 objects.appendleft('mtllib {}'.format(mtl_name))
                 # add the directive to use the exported material


Test patch:
diff --git a/tests/test_obj.py b/tests/test_obj.py
index bf6819c7..e514255f 100644
--- a/tests/test_obj.py
+++ b/tests/test_obj.py
@@ -267,6 +267,14 @@ class OBJTest(g.unittest.TestCase):
             mesh.export(file_type='obj'), file_type='obj')
         assert g.np.isclose(mesh.area, rec.area)
 
+    def test_no_uv_but_mtl(self):
+        sphere = g.trimesh.creation.uv_sphere()
+        sphere.visual = g.trimesh.visual.TextureVisuals(
+            uv=None,
+            material=g.trimesh.visual.material.empty_material())
+        output = sphere.export('sphere.obj')
+        assert('usemtl' in output)
+
     def test_chair(self):
         mesh = next(iter(g.get_mesh('chair.zip').geometry.values()))