nebius/SWE-bench-extra huggingface dataset:
Repository: odufrn/odufrn-downloader

Issue:
Criar classes de exception
# Feature

Hoje tratamos as exceptions de forma bem geral, porém poderíamos criar classes de exceção para nos auxiliarmos a lidar com os erros. Isso ajuda bastante nos testes, tornando-os mais assertivos, visto que o unittest tem a função ` assertRaises() `

> #### Participe do Hacktoberfest!
> Contribua com uma issue com a label `hacktoberfest` e abra um pull request durante o mês de outubro para ganhar os brindes do GitHub! Para se inscrever, acesse https://hacktoberfest.digitalocean.com/register

Comments:

Patch:
diff --git a/.gitignore b/.gitignore
index 9593d84..ef43f41 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 Pipfile
 Pipfile.lock
+env/
 .vscode/*
 .idea/*
 venv/*
diff --git a/odufrn_downloader/exceptions.py b/odufrn_downloader/exceptions.py
new file mode 100644
index 0000000..e69e97b
--- /dev/null
+++ b/odufrn_downloader/exceptions.py
@@ -0,0 +1,10 @@
+class odufrException(Exception):
+    def __init__(self):
+        default_message = 'Default Exception!'
+        super().__init__()
+
+
+class odufrIOError(odufrException):
+    def __init__(self):
+        default_message = 'odufrIOError Exception!'
+        super().__init__()
diff --git a/odufrn_downloader/modules/File.py b/odufrn_downloader/modules/File.py
index 7eac2f4..1cdeec2 100644
--- a/odufrn_downloader/modules/File.py
+++ b/odufrn_downloader/modules/File.py
@@ -1,5 +1,6 @@
 import os
 from .Package import Package
+from odufrn_downloader.exceptions import odufrIOError
 
 
 class File(Package):
@@ -34,5 +35,5 @@ class File(Package):
                     self.download_package(
                         packageName.rstrip(), path, dictionary, years
                     )
-        except IOError as ex:
-            self._print_exception(ex)
+        except IOError:
+            raise odufrIOError()


Test patch:
diff --git a/tests/test_file.py b/tests/test_file.py
index bb21fb0..4bd5fa3 100644
--- a/tests/test_file.py
+++ b/tests/test_file.py
@@ -1,5 +1,6 @@
 from .utils import *
 import tempfile
+from odufrn_downloader.modules.File import odufrIOError
 
 
 class Group(unittest.TestCase):
@@ -25,8 +26,6 @@ class Group(unittest.TestCase):
     def test_can_print_exception_download_packages_from_file(self):
         """Verifica se dado um arquivo com nomes errados de pacotes
         lança-se exceção."""
-        assert_console(
-            lambda: self.ufrn_data.download_from_file(
-                'potato', './tmp'
-            )
-        )
+
+        with self.assertRaises(odufrIOError):
+            self.ufrn_data.download_from_file('potato', './tmp')
Repository: omni-us/jsonargparse

Issue:
Config check failed with `add_subclass_arguments(required=False)`
```python
from jsonargparse import ArgumentParser

class A:
    ...

class B:
    ...

parser = ArgumentParser()
parser.add_subclass_arguments((A, B), nested_key="foo", required=False)
args = parser.parse_args()
```
produces:
```
scratch_12.py: error: Configuration check failed :: Parser key "foo": Value {} does not validate against any of the types in typing.Union[__main__.A, __main__.B]:
  - Type <class '__main__.A'> expects an str or a Dict with a class_path entry but got "{}"
  - Type <class '__main__.B'> expects an str or a Dict with a class_path entry but got "{}"
```

My assumption was that by setting `required=False`, `--foo` does not need to be passed.
And `args` would be an empty dictionary.

Comments:

Patch:
diff --git a/jsonargparse/signatures.py b/jsonargparse/signatures.py
index ba936c6..d0e509a 100644
--- a/jsonargparse/signatures.py
+++ b/jsonargparse/signatures.py
@@ -2,7 +2,7 @@
 
 import inspect
 import re
-from argparse import Namespace
+from argparse import Namespace, SUPPRESS
 from functools import wraps
 from typing import Any, Callable, List, Optional, Set, Tuple, Type, Union
 
@@ -491,7 +491,7 @@ class SignatureArguments:
             {},
             added_args,
             skip,
-            default={},
+            default=SUPPRESS,
             sub_configs=True,
             instantiate=instantiate,
             **kwargs


Test patch:
diff --git a/jsonargparse_tests/signatures_tests.py b/jsonargparse_tests/signatures_tests.py
index 87a55d4..757d37e 100755
--- a/jsonargparse_tests/signatures_tests.py
+++ b/jsonargparse_tests/signatures_tests.py
@@ -386,7 +386,9 @@ class SignaturesTests(unittest.TestCase):
         parser = ArgumentParser(parse_as_dict=True, error_handler=None)
         parser.add_subclass_arguments(calendar.Calendar, 'cal', required=False)
         cfg = parser.parse_args([])
-        self.assertEqual(cfg, {'cal': {}})
+        self.assertEqual(cfg, {})
+        cfg_init = parser.instantiate_classes(cfg)
+        self.assertEqual(cfg_init, {})
 
 
     def test_invalid_type(self):