nebius/SWE-bench-extra huggingface dataset:
Repository: springload/typed_environment_configuration

Issue:
Add integer number variable class
* Typed Environment Configuration version: 0.1.3
* Python version: 3.8.3
* Operating System: alpine linux

### Description

There is no way to set integer variable from environment variables currently.

### What I Did


```
from os import getenv
CACHE_MIDDLEWARE_SECONDS = int(getenv("DJANGO_CACHE_MIDDLEWARE_SECONDS", default=0))
```


Comments:

Patch:
diff --git a/typed_environment_configuration/typed_environment_configuration.py b/typed_environment_configuration/typed_environment_configuration.py
index 6429966..04e33ac 100644
--- a/typed_environment_configuration/typed_environment_configuration.py
+++ b/typed_environment_configuration/typed_environment_configuration.py
@@ -73,6 +73,10 @@ class StringVariable(Variable):
     _value_type = typepy.type.String
     _strict_level = 0
 
+class IntegerVariable(Variable):
+    _value_type = typepy.type.Integer
+    _strict_level = 1
+
 
 class StringListVariable(Variable):
     """


Test patch:
diff --git a/tests/test_typed_environment_configuration.py b/tests/test_typed_environment_configuration.py
index ad2babf..cb88eed 100644
--- a/tests/test_typed_environment_configuration.py
+++ b/tests/test_typed_environment_configuration.py
@@ -9,7 +9,11 @@ import os
 
 from typed_environment_configuration import *
 
-_ENVVARS = [BoolVariable("DEBUG"), StringVariable("DEFAULT_STRING", default="")]
+_ENVVARS = [
+    BoolVariable("DEBUG"),
+    IntegerVariable("INT_VAR"),
+    StringVariable("DEFAULT_STRING", default=""),
+]
 
 _PREFIXED_ENVVARS = [
     StringVariable("PREFIXED_VERSION"),
@@ -18,12 +22,14 @@ _PREFIXED_ENVVARS = [
 
 v = vars()
 
+
 class TestTyped_environment_configuration(unittest.TestCase):
     """Tests for `typed_environment_configuration` package."""
 
     def setUp(self):
         """Set up test fixtures, if any."""
         os.environ["DEBUG"] = "True"
+        os.environ["INT_VAR"] = "10"
         os.environ["PREFIXED_VERSION"] = "1.2.3"
 
         FillVars(_ENVVARS, v)
@@ -36,6 +42,10 @@ class TestTyped_environment_configuration(unittest.TestCase):
         """Tests that setting boolean variable in env creates a python variable DEBUG=True"""
         self.assertEqual(DEBUG, True)
 
+    def test_IntegerVariable(self):
+        """Tests that setting integer variable in env creates a python variable NUM_VAR=10"""
+        self.assertEqual(INT_VAR, 10)
+
     def test_PrefixedVariable(self):
         """Tests a prefixed variable"""
         self.assertEqual(VERSION, "1.2.3")
Repository: steemit/hivemind

Issue:
serve full json_metadata
Currently hivemind serves a filtered version of json_metadata; for compatibility it should just continue serve full json for now, as per the steemd API it replaces.

Comments:

Patch:
diff --git a/hive/utils/post.py b/hive/utils/post.py
index a1e5a14..562b518 100644
--- a/hive/utils/post.py
+++ b/hive/utils/post.py
@@ -19,10 +19,13 @@ def post_basic(post):
         pass
 
     thumb_url = ''
-    if md and 'image' in md and md['image']:
-        thumb_url = safe_img_url(first(md['image'])) or ''
-        if thumb_url:
-            md['image'] = [thumb_url]
+    if md and 'image' in md:
+        if md['image']:
+            if not isinstance(md['image'], list):
+                md['image'] = [md['image']]
+            md['image'] = list(filter(None, map(safe_img_url, md['image'])))
+        if md['image']:
+            thumb_url = md['image'][0]
         else:
             del md['image']
 


Test patch:
diff --git a/tests/utils/test_utils_post.py b/tests/utils/test_utils_post.py
index 21b0dca..58332e9 100644
--- a/tests/utils/test_utils_post.py
+++ b/tests/utils/test_utils_post.py
@@ -62,7 +62,7 @@ POST_1 = {
     "curator_payout_value": "0.000 SBD",
     "depth": 0,
     "id": 4437869,
-    "json_metadata": "{\"tags\":[\"spam\"],\"image\":[\"https://pbs.twimg.com/media/DBgNm3jXoAAioyE.jpg\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}",
+    "json_metadata": "{\"tags\":[\"spam\"],\"image\":[\"ddd\", \"https://pbs.twimg.com/media/DBgNm3jXoAAioyE.jpg\",\"https://example.com/image.jpg\"],\"app\":\"steemit/0.1\",\"format\":\"markdown\"}",
     "last_payout": "2017-06-27T15:53:51",
     "last_update": "2017-06-20T15:53:51",
     "max_accepted_payout": "1000000.000 SBD",
@@ -91,7 +91,7 @@ POST_1 = {
 
 def test_post_basic():
     ret = post_basic(POST_1)
-    expect = {'json_metadata': {'tags': ['spam'], 'image': ['https://pbs.twimg.com/media/DBgNm3jXoAAioyE.jpg'], 'app': 'steemit/0.1', 'format': 'markdown'},
+    expect = {'json_metadata': {'tags': ['spam'], 'image': ['https://pbs.twimg.com/media/DBgNm3jXoAAioyE.jpg', 'https://example.com/image.jpg'], 'app': 'steemit/0.1', 'format': 'markdown'},
               'image': 'https://pbs.twimg.com/media/DBgNm3jXoAAioyE.jpg',
               'tags': {'spam'},
               'is_nsfw': False,
Repository: stephantul/reach

Issue:
Fix bug: adding <UNK> resets dtype
Loading a .vec file with a given dtype (e.g., float32) using an OOV UNK token silently resets the dtype to the system default (usually float64).

Small fix

Comments:

Patch:
diff --git a/reach/reach.py b/reach/reach.py
index 59fb490..13d55a9 100644
--- a/reach/reach.py
+++ b/reach/reach.py
@@ -215,7 +215,7 @@ class Reach(object):
 
         if unk_word is not None:
             if unk_word not in items:
-                unk_vec = np.zeros((1, vectors.shape[1]))
+                unk_vec = np.zeros((1, vectors.shape[1]), dtype=desired_dtype)
                 vectors = np.concatenate([unk_vec, vectors], 0)
                 items = [unk_word] + items
                 unk_index = 0


Test patch:
diff --git a/tests/test_io.py b/tests/test_io.py
index 95d13d2..7851300 100644
--- a/tests/test_io.py
+++ b/tests/test_io.py
@@ -64,9 +64,13 @@ class TestLoad(unittest.TestCase):
             instance = Reach.load(tempfile.name, unk_word=None)
             self.assertEqual(instance.unk_index, None)
 
-            instance = Reach.load(tempfile.name, unk_word="[UNK]")
+            desired_dtype = "float32"
+            instance = Reach.load(
+                tempfile.name, unk_word="[UNK]", desired_dtype=desired_dtype
+            )
             self.assertEqual(instance.unk_index, 0)
             self.assertEqual(instance.items["[UNK]"], instance.unk_index)
+            self.assertEqual(instance.vectors.dtype, desired_dtype)
 
             instance = Reach.load(tempfile.name, unk_word="splinter")
             self.assertEqual(instance.unk_index, 2)