nebius/SWE-bench-extra huggingface dataset:
Repository: pydata/pydata-google-auth

Issue:
APPDATA environment variable must exist when running on windows
The os.environ['APPDATA'] lookup in Cache.py line 29 always gets run, even if credentials are passed.  `%APPDATA%` is not guaranteed to be set, as it is not on the windows 2012R2 server service accounts that I have been attempting to use.

The resulting error message when APPDATA is not set is quite opaque.  Especially as the call which triggers the error, like my pandas.to_gbq() call, could have explicitly passed credentials.

This problem can be worked-around with 
`IF "%APPDATA%"=="" set APPDATA="PYDATA-GOOGLE-AUTH needs this to be set"`

Comments:

Patch:
diff --git a/pydata_google_auth/cache.py b/pydata_google_auth/cache.py
index 13b9457..cad9097 100644
--- a/pydata_google_auth/cache.py
+++ b/pydata_google_auth/cache.py
@@ -25,9 +25,11 @@ def _get_default_credentials_path(credentials_dirname, credentials_filename):
     str
         Path to the Google user credentials
     """
+    config_path = None
+
     if os.name == "nt":
-        config_path = os.environ["APPDATA"]
-    else:
+        config_path = os.getenv("APPDATA")
+    if not config_path:
         config_path = os.path.join(os.path.expanduser("~"), ".config")
 
     config_path = os.path.join(config_path, credentials_dirname)


Test patch:
diff --git a/tests/unit/test_cache.py b/tests/unit/test_cache.py
index d2fdea2..1e513c3 100644
--- a/tests/unit/test_cache.py
+++ b/tests/unit/test_cache.py
@@ -34,6 +34,19 @@ def test_import_unwriteable_fs(module_under_test, monkeypatch):
     assert module_under_test.NOOP is not None
 
 
+def test__get_default_credentials_path_windows_wo_appdata(
+    module_under_test, monkeypatch
+):
+    # Ensure default path returns something sensible on Windows, even if
+    # APPDATA is not set. See:
+    # https://github.com/pydata/pydata-google-auth/issues/29
+    monkeypatch.setattr(os, "name", "nt")
+    monkeypatch.delenv("APPDATA", raising=False)
+
+    creds_path = module_under_test._get_default_credentials_path("dirname", "filename")
+    assert creds_path is not None
+
+
 def test__save_user_account_credentials_wo_directory(module_under_test, fs):
     """Directories should be created if they don't exist."""
Repository: pydata/sparse

Issue:
Bug in converting from DOK to COO
I originally noticed this bug when I tried the following, 

`sparse.DOK.from_coo(sparse.ones((2,2), dtype=bool)).to_coo().todense()`.

It yields 

```
array([[0., 0.],
       [0., 0.]])
```

However, the issue is even more basic for example the following:

`sparse.DOK.from_coo(sparse.ones((2,2))).to_coo().todense()`,

yields the same result,

```
array([[0., 0.],
       [0., 0.]])
```

The correct results ought to be 

```
array([[True, True],
       [True, True]])
```

and 

```
array([[1., 1.],
       [1., 1.]])
```

Comments:

Patch:
diff --git a/sparse/coo/core.py b/sparse/coo/core.py
index 71fe0d5..727df16 100644
--- a/sparse/coo/core.py
+++ b/sparse/coo/core.py
@@ -479,11 +479,9 @@ class COO(SparseArray, NDArrayOperatorsMixin):
             ndim = 0 if shape is None else len(shape)
             coords = np.empty((ndim, 0), dtype=np.uint8)
             data = np.empty((0,))
+            shape = () if shape is None else shape
 
-            return COO(coords, data, shape=() if shape is None else shape,
-                       sorted=True, has_duplicates=False)
-
-        if not isinstance(x[0][0], Iterable):
+        elif not isinstance(x[0][0], Iterable):
             coords = np.stack(x[1], axis=0)
             data = np.asarray(x[0])
         else:
diff --git a/sparse/dok.py b/sparse/dok.py
index b4f1233..1351cbd 100644
--- a/sparse/dok.py
+++ b/sparse/dok.py
@@ -125,7 +125,7 @@ class DOK(SparseArray):
     def _make_shallow_copy_of(self, other):
         self.dtype = other.dtype
         self.data = other.data
-        super(DOK, self).__init__(other.shape)
+        super(DOK, self).__init__(other.shape, fill_value=other.fill_value)
 
     @classmethod
     def from_coo(cls, x):


Test patch:
diff --git a/sparse/tests/test_dok.py b/sparse/tests/test_dok.py
index 2443f33..e9d3d4a 100644
--- a/sparse/tests/test_dok.py
+++ b/sparse/tests/test_dok.py
@@ -169,3 +169,11 @@ def test_asformat(format):
     s2 = s.asformat(format)
 
     assert_eq(s, s2)
+
+
+def test_coo_fv_interface():
+    s1 = sparse.full((5, 5), fill_value=1+np.random.rand())
+    s2 = sparse.DOK(s1)
+    assert_eq(s1, s2)
+    s3 = sparse.COO(s2)
+    assert_eq(s1, s3)
Repository: pydata/sparse

Issue:
Setting DOK elements to zero doesn't work.
Trivial example:

```
>>> import sparse
>>> import numpy as np
>>> s = sparse.DOK((1,))
>>> s[0] = 1
>>> s[0]
1.0
>>> s[0] = 0
>>> s[0]
1.0
```

Comments:

Patch:
diff --git a/sparse/dok.py b/sparse/dok.py
index 65ede6f..9beaada 100644
--- a/sparse/dok.py
+++ b/sparse/dok.py
@@ -339,8 +339,11 @@ class DOK(object):
                 raise IndexError('All indices must be slices or integers'
                                  ' when setting an item.')
 
+        key = tuple(key_list)
         if value != _zero_of_dtype(self.dtype):
-            self.data[tuple(key_list)] = value[()]
+            self.data[key] = value[()]
+        elif key in self.data:
+            del self.data[key]
 
     def __str__(self):
         return "<DOK: shape=%s, dtype=%s, nnz=%d>" % (self.shape, self.dtype, self.nnz)


Test patch:
diff --git a/sparse/tests/test_dok.py b/sparse/tests/test_dok.py
index 568c1d0..45c9899 100644
--- a/sparse/tests/test_dok.py
+++ b/sparse/tests/test_dok.py
@@ -149,3 +149,12 @@ def test_float_dtype():
     s = DOK((5,), data)
 
     assert s.dtype == np.float32
+
+
+def test_set_zero():
+    s = DOK((1,), dtype=np.uint8)
+    s[0] = 1
+    s[0] = 0
+
+    assert s[0] == 0
+    assert s.nnz == 0