anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: opencv/cvat
Issue: Uploading of annotations results in all frames being keyframes

Annotations dumped in CVAT XML 1.1 for videos and uploaded for a similar task. However after uploading all frames are keyframes even though XML has information on which frames should be keyframes.
This makes it tedious to make changes to a track as each frame has to be edited 

Changed files:
cvat/apps/annotation/cvat.py

diff --git a/cvat/apps/annotation/cvat.py b/cvat/apps/annotation/cvat.py
index ab249304..ec687812 100644
--- a/cvat/apps/annotation/cvat.py
+++ b/cvat/apps/annotation/cvat.py
@@ -398,7 +398,8 @@ def load(file_object, annotations):
                         shape['points'].extend(map(float, pair.split(',')))
 
                 if track is not None:
-                    track.shapes.append(annotations.TrackedShape(**shape))
+                    if shape["keyframe"]:
+                        track.shapes.append(annotations.TrackedShape(**shape))
                 else:
                     annotations.add_shape(annotations.LabeledShape(**shape))
                 shape = None
Repository: tweepy/tweepy
Issue: JSONParser.parse() returns None if only 'next_cursor' available.

It looks like someone has broken an if/else when refactoring, which causes python to drop off the end of the function without returning anything useful.

https://github.com/tweepy/tweepy/blame/master/tweepy/parsers.py#L57


Changed files:
tweepy/parsers.py

diff --git a/tweepy/parsers.py b/tweepy/parsers.py
index 6381912..046cf50 100644
--- a/tweepy/parsers.py
+++ b/tweepy/parsers.py
@@ -54,11 +54,11 @@ class JSONParser(Parser):
             raise TweepError('Failed to parse JSON payload: %s' % e)
 
         needs_cursors = 'cursor' in method.session.params
-        if needs_cursors and isinstance(json, dict):
-            if 'previous_cursor' in json:
-                if 'next_cursor' in json:
-                    cursors = json['previous_cursor'], json['next_cursor']
-                    return json, cursors
+        if needs_cursors and isinstance(json, dict) \\
+                and 'previous_cursor' in json \\
+                and 'next_cursor' in json:
+            cursors = json['previous_cursor'], json['next_cursor']
+            return json, cursors
         else:
             return json
Repository: tweepy/tweepy
Issue: FileNotFoundError in api.media_upload using the file argument

I tried to upload an image created in memory by using the file argument of `api.media_upload` 


code:
```python
import tweepy
from PIL import Image
import numpy as np
import io

consumer_key=""
consumer_secret=""

access_token=""
access_token_secret=""

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth)
    
X = array = np.random.randint(255, size=(900, 1600, 3), dtype=np.uint8)

im = Image.fromarray(array, mode="RGB")
    
b = io.BytesIO()

im.save(b, "PNG")
b.seek(0)
fp = io.BufferedReader(b)
    
media = api.media_upload('test.png', file=fp)

api.update_status("message", media_ids=[media.media_id])

```

returns Error:

```
Traceback (most recent call last):
  File "/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/main.py", line 42, in <module>
    main()
  File "/main.py", line 36, in main
    media = api.media_upload('test.png', file=h)
  File "/tweepy/api.py", line 225, in media_upload
    file_type = imghdr.what(filename) or mimetypes.guess_type(filename)[0]
  File "/lib/python3.8/imghdr.py", line 16, in what
    f = open(file, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'test.png'
```


Changed files:
tweepy/api.py

diff --git a/tweepy/api.py b/tweepy/api.py
index 4a2599c..66e95d2 100644
--- a/tweepy/api.py
+++ b/tweepy/api.py
@@ -221,7 +221,12 @@ class API(object):
         """
         f = kwargs.pop('file', None)
 
-        file_type = imghdr.what(filename) or mimetypes.guess_type(filename)[0]
+        h = None
+        if f is not None:
+            location = f.tell()
+            h = f.read(32)
+            f.seek(location)
+        file_type = imghdr.what(filename, h=h) or mimetypes.guess_type(filename)[0]
         if file_type == 'gif':
             max_size = 14649
         else:
Repository: thumbor/thumbor
Issue: Why is a file generated every time a meta url is refreshed?

Why is a file generated every time a meta url is refreshed?

url：
http://127.0.0.1:8888/unsafe/meta/http://127.0.0.1:9999/test/5d8cce994c0190cbdb2f1e0914286c0a

These files are all from the same meta url.

Shouldn't only one file be correct?

![example](https://github.com/thumbor/thumbor/assets/17996289/a4da8be6-59d6-48bc-9987-e43af76ab883)


Changed files:
thumbor/handlers/__init__.py, tests/handlers/test_base_handler_with_result_storage.py

diff --git a/tests/handlers/test_base_handler_with_result_storage.py b/tests/handlers/test_base_handler_with_result_storage.py
index a799ea4..2a7de3b 100644
--- a/tests/handlers/test_base_handler_with_result_storage.py
+++ b/tests/handlers/test_base_handler_with_result_storage.py
@@ -8,6 +8,7 @@
 # http://www.opensource.org/licenses/mit-license
 # Copyright (c) 2011 globo.com thumbor@googlegroups.com
 
+import json
 import os
 from os.path import dirname
 from shutil import which
@@ -77,6 +78,34 @@ class ImageOperationsWithResultStorageTestCase(BaseImagingTestCase):
         expect(expected_path).to_exist()
         expect(response.body).to_be_similar_to(animated_image())
 
+    @patch("tornado.ioloop.IOLoop.instance")
+    @gen_test
+    async def test_saves_meta_to_result_storage(self, instance_mock):
+        instance_mock.return_value = self.io_loop
+        response = await self.async_fetch(
+            "/oGi9XL4nHJKGEKVHjHEp1Jg1KpM=/meta/animated.gif"
+        )
+        expect(response.code).to_equal(200)
+
+        self.context.request = Mock(
+            accepts_webp=False,
+        )
+        expected_path = self.result_storage.normalize_path(
+            "/oGi9XL4nHJKGEKVHjHEp1Jg1KpM=/meta/animated.gif"
+        )
+        expect(expected_path).to_exist()
+
+        expected_source = {
+            "frameCount": 2,
+            "height": 100,
+            "url": "animated.gif",
+            "width": 100,
+        }
+        metadata = json.loads(response.body)
+        expect(metadata).to_include("thumbor")
+        expect(metadata["thumbor"]).to_include("source")
+        expect(metadata["thumbor"]["source"]).to_be_like(expected_source)
+
 
 class ImageOperationsResultStorageOnlyTestCase(BaseImagingTestCase):
     def get_context(self):
diff --git a/thumbor/handlers/__init__.py b/thumbor/handlers/__init__.py
index 72ee807..b7d5558 100644
--- a/thumbor/handlers/__init__.py
+++ b/thumbor/handlers/__init__.py
@@ -660,11 +660,17 @@ class BaseHandler(tornado.web.RequestHandler):
         await self._write_results_to_client(results, content_type)
 
         if should_store:
+            results = self._ensure_bytes(results)
             await self._store_results(result_storage, metrics, results)
 
         # can't cleanup before storing results as the storage requires context
         self._cleanup()
 
+    def _ensure_bytes(self, results):
+        if isinstance(results, str):
+            return results.encode()
+        return results
+
     def _cleanup(self):
         self.context.request_handler = None