nebius/SWE-bench-extra huggingface dataset:
Repository: ros-infrastructure/rosdep

Issue:
`rosdep resolve` on version 0.16.2 yields `TypeError`
I installed `rosdep` from PyPI. `rosdep resolve` yields the failing the stack trace below:
```
acarrillo ~ $ rosdep resolve

ERROR: Rosdep experienced an error: argument of type 'NoneType' is not iterable
Please go to the rosdep page [1] and file a bug report with the stack trace below.
[1] : http://www.ros.org/wiki/rosdep

rosdep version: 0.16.2

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/rosdep2/main.py", line 144, in rosdep_main
    exit_code = _rosdep_main(args)
  File "/usr/local/lib/python2.7/dist-packages/rosdep2/main.py", line 406, in _rosdep_main
    if os.environ['ROS_DISTRO'] in python_versions:
TypeError: argument of type 'NoneType' is not iterable
```

Comments:

Patch:
diff --git a/src/rosdep2/main.py b/src/rosdep2/main.py
index 1b6b816..764ddad 100644
--- a/src/rosdep2/main.py
+++ b/src/rosdep2/main.py
@@ -402,7 +402,7 @@ def _rosdep_main(args):
 
     if 'ROS_PYTHON_VERSION' not in os.environ and 'ROS_DISTRO' in os.environ:
         # Set python version to version used by ROS distro
-        python_versions = MetaDatabase().get('ROS_PYTHON_VERSION')
+        python_versions = MetaDatabase().get('ROS_PYTHON_VERSION', default=[])
         if os.environ['ROS_DISTRO'] in python_versions:
             os.environ['ROS_PYTHON_VERSION'] = str(python_versions[os.environ['ROS_DISTRO']])
 
diff --git a/src/rosdep2/meta.py b/src/rosdep2/meta.py
index 29bd317..b8cd900 100644
--- a/src/rosdep2/meta.py
+++ b/src/rosdep2/meta.py
@@ -102,7 +102,7 @@ class MetaDatabase:
         write_cache_file(self._cache_dir, category, wrapper)
         self._loaded[category] = wrapper
 
-    def get(self, category):
+    def get(self, category, default=None):
         """Return metadata in the cache, or None if there is no cache entry."""
         if category not in self._loaded:
             self._load_from_cache(category, self._cache_dir)
@@ -110,6 +110,8 @@ class MetaDatabase:
         if category in self._loaded:
             return self._loaded[category].data
 
+        return default
+
     def _load_from_cache(self, category, cache_dir):
         filename = compute_filename_hash(category) + PICKLE_CACHE_EXT
         try:


Test patch:
diff --git a/test/test_metadata.py b/test/test_metadata.py
index 0caf844..424a5ac 100644
--- a/test/test_metadata.py
+++ b/test/test_metadata.py
@@ -65,6 +65,14 @@ def test_metadatabase_get_none():
         assert db.get('fruit') is None
 
 
+def test_metadatabase_get_default():
+    with TemporaryDirectory() as tmpdir:
+        db = MetaDatabase(cache_dir=tmpdir)
+        assert db.get('fruit', default='foo') == 'foo'
+        db.set('fruit', 'tomato')
+        assert db.get('fruit', default='foo') != 'foo'
+
+
 def test_metadatabase_get_mutate_get():
     with TemporaryDirectory() as tmpdir:
         db = MetaDatabase(cache_dir=tmpdir)