internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: openvinotoolkit/datumaro

Issue:
Update type definitions wrt new attrs features
Review and update `extractor.py` and other files.


> Changed in version 21.1.0: init=False injects \_\_attrs_init\_\_ 

Should fix our class patching in Bbox.


Discussion:

Resolving patch:
diff --git a/datumaro/components/extractor.py b/datumaro/components/extractor.py
--- a/datumaro/components/extractor.py
+++ b/datumaro/components/extractor.py
@@ -360,7 +360,7 @@ def get_area(self):
         return 0
 
 
-@attrs
+@attrs(init=False)
 class Cuboid3d(Annotation):
     _type = AnnotationType.cuboid_3d
     _points = attrib(type=list, default=None)
@@ -376,8 +376,6 @@ def _points_validator(self, attribute, points):
             points = [round(p, _COORDINATE_ROUNDING_DIGITS) for p in points]
         self._points = points
 
-    # will be overridden by attrs, then will be overridden again by us
-    # attrs' method will be renamed to __attrs_init__
     def __init__(self, position, rotation=None, scale=None, **kwargs):
         assert len(position) == 3, position
         if not rotation:
@@ -386,7 +384,6 @@ def __init__(self, position, rotation=None, scale=None, **kwargs):
             scale = [1] * 3
         kwargs.pop('points', None)
         self.__attrs_init__(points=[*position, *rotation, *scale], **kwargs)
-    __actual_init__ = __init__ # save pointer
 
     @property
     def position(self):
@@ -421,9 +418,6 @@ def _set_scale(self, value):
         self.scale[:] = \
             [round(p, _COORDINATE_ROUNDING_DIGITS) for p in value]
 
-assert not hasattr(Cuboid3d, '__attrs_init__') # hopefully, it will be supported
-setattr(Cuboid3d, '__attrs_init__', Cuboid3d.__init__)
-setattr(Cuboid3d, '__init__', Cuboid3d.__actual_init__)
 
 @attrs
 class Polygon(_Shape):
@@ -442,16 +436,13 @@ def get_area(self):
         area = mask_utils.area(rle)[0]
         return area
 
-@attrs
+@attrs(init=False)
 class Bbox(_Shape):
     _type = AnnotationType.bbox
 
-    # will be overridden by attrs, then will be overridden again by us
-    # attrs' method will be renamed to __attrs_init__
     def __init__(self, x, y, w, h, *args, **kwargs):
         kwargs.pop('points', None) # comes from wrap()
         self.__attrs_init__([x, y, x + w, y + h], *args, **kwargs)
-    __actual_init__ = __init__ # save pointer
 
     @property
     def x(self):
@@ -493,9 +484,6 @@ def wrap(item, **kwargs):
         d.update(kwargs)
         return attr.evolve(item, **d)
 
-assert not hasattr(Bbox, '__attrs_init__') # hopefully, it will be supported
-setattr(Bbox, '__attrs_init__', Bbox.__init__)
-setattr(Bbox, '__init__', Bbox.__actual_init__)
 
 @attrs
 class PointsCategories(Categories):


Test patch:
Repository: openvinotoolkit/datumaro

Issue:
Cannot import captions with double quotes ICDAR Word Recognition
The original ICDAR 13/15 dataset for word recognition task contains captions with double quotes (e.g "READER\\"").
When I try to load this dataset, Datumaro throws an exception with the message:
`Line word_136.png, "(412\")": unexpected number of quotes in filename`.


Discussion:

Resolving patch:
diff --git a/datumaro/plugins/icdar_format/extractor.py b/datumaro/plugins/icdar_format/extractor.py
--- a/datumaro/plugins/icdar_format/extractor.py
+++ b/datumaro/plugins/icdar_format/extractor.py
@@ -3,6 +3,7 @@
 # SPDX-License-Identifier: MIT
 
 from glob import iglob
+import logging as log
 import os.path as osp
 
 import numpy as np
@@ -59,16 +60,13 @@ def _load_recognition_items(self):
                 objects = line.split(', ')
                 if len(objects) == 2:
                     image = objects[0]
-                    objects = objects[1].split('\"')
-                    if 1 < len(objects):
-                        if len(objects) % 2:
-                            captions = [objects[2 * i + 1]
-                                for i in range(int(len(objects) / 2))]
+                    captions = []
+                    for caption in objects[1:]:
+                        if caption[0] != '\"' or caption[-1] != '\"':
+                            log.warning("Line %s: unexpected number "
+                                "of quotes" % line)
                         else:
-                            raise Exception("Line %s: unexpected number "
-                                "of quotes in filename" % line)
-                    else:
-                        captions = objects[0].split()
+                            captions.append(caption.replace('\\', '')[1:-1])
                 else:
                     image = objects[0][:-1]
                     captions = []


Test patch:
diff --git a/tests/test_icdar_format.py b/tests/test_icdar_format.py
--- a/tests/test_icdar_format.py
+++ b/tests/test_icdar_format.py
@@ -255,3 +255,16 @@ def test_can_save_and_load_image_with_arbitrary_extension(self):
                 self._test_save_and_load(expected,
                     partial(converter.convert, save_images=True),
                     test_dir, importer, require_images=True)
+
+    @mark_requirement(Requirements.DATUM_GENERAL_REQ)
+    def test_can_save_and_load_captions_with_quotes(self):
+        expected_dataset = Dataset.from_iterable([
+            DatasetItem(id='1', image=np.ones((5, 5, 3)),
+                annotations=[Caption('caption\"')]
+            )
+        ])
+
+        with TestDir() as test_dir:
+            self._test_save_and_load(expected_dataset,
+                partial(IcdarWordRecognitionConverter.convert, save_images=True),
+                test_dir, 'icdar_word_recognition')
Repository: openvinotoolkit/datumaro

Issue:
Wrong annotated return type in Registry class
https://github.com/openvinotoolkit/datumaro/blob/0d4a73d3bbe3a93585af7a0148a0e344fd1106b3/datumaro/components/environment.py#L41-L42
In the referenced code the return type of the method appears to be wrong. 

Either it should be `Iterator[str]` since iteration over a dict returns its keys which are of type `str` or the return statement should be `return iter(self.items.values())`.

When using the library with static type checkers this annotation causes type check errors. When removing the annotation, type checkers correctly infer the type `Iterator[str]`.
Wrong annotated return type in Registry class
https://github.com/openvinotoolkit/datumaro/blob/0d4a73d3bbe3a93585af7a0148a0e344fd1106b3/datumaro/components/environment.py#L41-L42
In the referenced code the return type of the method appears to be wrong. 

Either it should be `Iterator[str]` since iteration over a dict returns its keys which are of type `str` or the return statement should be `return iter(self.items.values())`.

When using the library with static type checkers this annotation causes type check errors. When removing the annotation, type checkers correctly infer the type `Iterator[str]`.


Discussion:

Resolving patch:
diff --git a/datumaro/components/environment.py b/datumaro/components/environment.py
--- a/datumaro/components/environment.py
+++ b/datumaro/components/environment.py
@@ -38,7 +38,7 @@ def __getitem__(self, key: str) -> T:
     def __contains__(self, key) -> bool:
         return key in self.items
 
-    def __iter__(self) -> Iterator[T]:
+    def __iter__(self) -> Iterator[str]:
         return iter(self.items)
 
 


Test patch:
Repository: openvinotoolkit/datumaro

Issue:
`loglevel` does not affect CLI output



Discussion:

Resolving patch:
diff --git a/datumaro/cli/__main__.py b/datumaro/cli/__main__.py
--- a/datumaro/cli/__main__.py
+++ b/datumaro/cli/__main__.py
@@ -40,8 +40,17 @@ def init_logger(cls, args=None):
         parser = argparse.ArgumentParser(add_help=False)
         cls._define_loglevel_option(parser)
         args, _ = parser.parse_known_args(args)
-
-        log.basicConfig(format="%(asctime)s %(levelname)s: %(message)s", level=args.loglevel)
+        log_format = "%(asctime)s %(levelname)s: %(message)s"
+
+        # Try setting up logging with basicConfig.
+        # This does nothing, if other parts of the software
+        # already configured handlers, i.e. during imports and when
+        # main is called programmatically.
+        log.basicConfig(format=log_format, level=args.loglevel)
+        # Force-overwrite the log level and formatter
+        log.root.setLevel(args.loglevel)
+        for h in log.root.handlers:
+            h.setFormatter(log.Formatter(log_format))
 
         # Suppress own deprecation warnings
         warnings.filterwarnings("ignore", category=DeprecationWarning, module=r"datumaro\..*")


Test patch:
Repository: openvinotoolkit/datumaro

Issue:
Automatic generation of specs.json by running specs.py is broken
After merging https://github.com/openvinotoolkit/datumaro/pull/1268, `metadata` is newly introduced in `specs.json`, but the automated `specs.json` doesn't create `metadata`, and hence it breaks the lazy_load of importers.


Discussion:

Resolving patch:
diff --git a/src/datumaro/plugins/specs.py b/src/datumaro/plugins/specs.py
--- a/src/datumaro/plugins/specs.py
+++ b/src/datumaro/plugins/specs.py
@@ -43,14 +43,18 @@ def _enroll_to_plugin_specs(plugins, plugin_type):
             mod = plugin.__module__
             class_name = plugin.__name__
             plugin_name = plugin.NAME
-            plugin_specs += [
-                {
-                    "import_path": f"{mod}.{class_name}",
-                    "plugin_name": plugin_name,
-                    "plugin_type": plugin_type,
-                    "extra_deps": get_extra_deps(plugin),
-                }
-            ]
+            extra_deps = get_extra_deps(plugin)
+            plugin_spec = {
+                "import_path": f"{mod}.{class_name}",
+                "plugin_name": plugin_name,
+                "plugin_type": plugin_type,
+            }
+            if extra_deps:
+                plugin_spec["extra_deps"] = extra_deps
+            # Setting metadata for importers
+            if hasattr(plugin, "get_file_extensions"):
+                plugin_spec["metadata"] = {"file_extensions": sorted(plugin.get_file_extensions())}
+            plugin_specs.append(plugin_spec)
 
     _enroll_to_plugin_specs(env.extractors, "DatasetBase")
     _enroll_to_plugin_specs(env.importers, "Importer")


Test patch:
Repository: aws/serverless-application-model

Issue:
Rendering on PyPI is broken
**Description:**
Rendering of the README on PyPI is broken because it expects RST by default and Markdown is being uploaded.

**Steps to reproduce the issue:**

1. Go to https://pypi.org/project/aws-sam-translator/

**Observed result:**

Raw markdown

**Expected result:**

Links and images working



Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -54,6 +54,7 @@ def read_requirements(req='base.txt'):
     version=read_version(),
     description='AWS SAM Translator is a library that transform SAM templates into AWS CloudFormation templates',
     long_description=read('README.md'),
+    long_description_content_type='text/markdown',
     author='Amazon Web Services',
     author_email='aws-sam-developers@amazon.com',
     url='https://github.com/awslabs/serverless-application-model',


Test patch:
Repository: certbot/certbot

Issue:
ReadTheDocs doesn't render some API pages
For the following API pages the generated output is empty:
- http://letsencrypt.readthedocs.org/en/latest/api/client/augeas_configurator.html
- http://letsencrypt.readthedocs.org/en/latest/api/client/client.html

It works locally though...



Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -17,6 +17,14 @@
 import re
 import sys
 
+import mock
+
+
+# http://docs.readthedocs.org/en/latest/faq.html#i-get-import-errors-on-libraries-that-depend-on-c-modules
+# c.f. #262
+sys.modules.update(
+    (mod_name, mock.MagicMock()) for mod_name in ['augeas', 'M2Crypto'])
+
 here = os.path.abspath(os.path.dirname(__file__))
 
 # read version number (and other metadata) from package init
@@ -117,7 +125,15 @@
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'default'
+
+# http://docs.readthedocs.org/en/latest/theme.html#how-do-i-use-this-locally-and-on-read-the-docs
+# on_rtd is whether we are on readthedocs.org
+on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
+if not on_rtd:  # only import and set the theme if we're building docs locally
+    import sphinx_rtd_theme
+    html_theme = 'sphinx_rtd_theme'
+    html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
+# otherwise, readthedocs.org uses their theme by default, so no need to specify it
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
diff --git a/letsencrypt/client/interfaces.py b/letsencrypt/client/interfaces.py
--- a/letsencrypt/client/interfaces.py
+++ b/letsencrypt/client/interfaces.py
@@ -30,9 +30,10 @@ def perform(chall_list):
 
         :param list chall_list: List of namedtuple types defined in
             :mod:`letsencrypt.client.challenge_util` (``DvsniChall``, etc.).
+
             - chall_list will never be empty
             - chall_list will only contain types found within
-                :func:`get_chall_pref`
+              :func:`get_chall_pref`
 
         :returns: ACME Challenge responses or if it cannot be completed then:
 
@@ -52,7 +53,7 @@ def cleanup(chall_list):
             :mod:`letsencrypt.client.challenge_util` (``DvsniChall``, etc.)
 
             - Only challenges given previously in the perform function will be
-            found in chall_list.
+              found in chall_list.
             - chall_list will never be empty
 
         """
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -40,8 +40,12 @@ def read_file(filename, encoding='utf8'):
 
 dev_extras = [
     'pylint>=1.4.0',  # upstream #248
+]
+
+docs_extras = [
     'repoze.sphinx.autointerface',
     'Sphinx',
+    'sphinx_rtd_theme',
 ]
 
 testing_extras = [
@@ -73,6 +77,7 @@ def read_file(filename, encoding='utf8'):
     test_suite='letsencrypt',
     extras_require={
         'dev': dev_extras,
+        'docs': docs_extras,
         'testing': testing_extras,
     },
     entry_points={


Test patch:
Repository: certbot/certbot

Issue:
Executing letsencrypt outside of git repo (when globally installed) fails looking for EULA
I think the EULA just has to be included in the package, but I've not had a moment to try it.  Sorry for the spam!  Here's the error -- nothing crazy (and this occurs in every flavor of linux I poked at this morning):

```
(venv)root@vpn:~# letsencrypt
Traceback (most recent call last):
  File "/root/lets-encrypt-preview/venv/bin/letsencrypt", line 9, in <module>
    load_entry_point('letsencrypt==0.1', 'console_scripts', 'letsencrypt')()
  File "/root/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/letsencrypt-0.1-py2.7.egg/letsencrypt/scripts/main.py", line 137, in main
    display_eula()
  File "/root/lets-encrypt-preview/venv/local/lib/python2.7/site-packages/letsencrypt-0.1-py2.7.egg/letsencrypt/scripts/main.py", line 194, in display_eula
    with open("EULA") as eula_file:
IOError: [Errno 2] No such file or directory: 'EULA'
(venv)root@vpn:~#
```



Discussion:
Thanks for reporting this @pavgup.  

It should be using pkg_resources, however this code will soon be replaced by...
https://github.com/letsencrypt/acme-spec/pull/69

Totally my pleasure.  You guys rock.  I actually stumbled in to the explicit agreement changes, but I guessed the EULA was largely standing in as a disclaimer against pre-release software usage.  I should say I love the idea that the client would control the flow of acceptances -- it allows a discerning person to reject requirements that might be too onerous in the open rather than stumbling into onerous requirements in the moment.


Resolving patch:
diff --git a/letsencrypt/scripts/main.py b/letsencrypt/scripts/main.py
--- a/letsencrypt/scripts/main.py
+++ b/letsencrypt/scripts/main.py
@@ -7,6 +7,7 @@
 import argparse
 import logging
 import os
+import pkg_resources
 import sys
 
 import confargparse
@@ -191,10 +192,10 @@ def main():  # pylint: disable=too-many-branches, too-many-statements
 
 def display_eula():
     """Displays the end user agreement."""
-    with open("EULA") as eula_file:
-        if not zope.component.getUtility(interfaces.IDisplay).yesno(
-                eula_file.read(), "Agree", "Cancel"):
-            sys.exit(0)
+    eula = pkg_resources.resource_string("letsencrypt", "EULA")
+    if not zope.component.getUtility(interfaces.IDisplay).yesno(
+            eula, "Agree", "Cancel"):
+        sys.exit(0)
 
 
 def read_file(filename):


Test patch:
Repository: certbot/certbot

Issue:
False responses from IAuthenticator.perform not handled properly
Please see https://github.com/letsencrypt/lets-encrypt-preview/pull/267#discussion_r25478823



Discussion:

Resolving patch:
diff --git a/letsencrypt/client/auth_handler.py b/letsencrypt/client/auth_handler.py
--- a/letsencrypt/client/auth_handler.py
+++ b/letsencrypt/client/auth_handler.py
@@ -203,7 +203,8 @@ def _assign_responses(self, flat_list, ichall_dict):
 
     def _path_satisfied(self, dom):
         """Returns whether a path has been completely satisfied."""
-        return all(self.responses[dom][i] is not None for i in self.paths[dom])
+        # Make sure that there are no 'None' or 'False' entries along path.
+        return all(self.responses[dom][i] for i in self.paths[dom])
 
     def _get_chall_pref(self, domain):
         """Return list of challenge preferences.


Test patch:
diff --git a/letsencrypt/client/tests/auth_handler_test.py b/letsencrypt/client/tests/auth_handler_test.py
--- a/letsencrypt/client/tests/auth_handler_test.py
+++ b/letsencrypt/client/tests/auth_handler_test.py
@@ -481,7 +481,7 @@ def test_satisfied_true(self):
         self.handler.responses[dom[0]] = [None, "sat", "sat2", None]
 
         self.handler.paths[dom[1]] = [0]
-        self.handler.responses[dom[1]] = ["sat", None, None, None]
+        self.handler.responses[dom[1]] = ["sat", None, None, False]
 
         self.handler.paths[dom[2]] = [0]
         self.handler.responses[dom[2]] = ["sat"]
@@ -496,7 +496,7 @@ def test_satisfied_true(self):
             self.assertTrue(self.handler._path_satisfied(dom[i]))
 
     def test_not_satisfied(self):
-        dom = ["0", "1", "2"]
+        dom = ["0", "1", "2", "3"]
         self.handler.paths[dom[0]] = [1, 2]
         self.handler.responses[dom[0]] = ["sat1", None, "sat2", None]
 
@@ -506,6 +506,9 @@ def test_not_satisfied(self):
         self.handler.paths[dom[2]] = [0]
         self.handler.responses[dom[2]] = [None]
 
+        self.handler.paths[dom[3]] = [0]
+        self.handler.responses[dom[3]] = [False]
+
         for i in xrange(3):
             self.assertFalse(self.handler._path_satisfied(dom[i]))
Repository: certbot/certbot

Issue:
Lost Vagrant docs
ce2a6b7c5a3549ce5a1a04fb33d4254f78bd1b1f removed documentation for Vagrant in `CONTRIBUTING.rst`



Discussion:

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -101,7 +101,7 @@
 
 # The reST default role (used for this markup: `text`) to use for all
 # documents.
-#default_role = None
+default_role = 'py:obj'
 
 # If true, '()' will be appended to :func: etc. cross-reference text.
 #add_function_parentheses = True


Test patch:
Repository: certbot/certbot

Issue:
Requests SSL InsecurePlatformWarning
venv/local/lib/python2.7/site-packages/requests-2.6.0
py2.7.egg/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning

I received this for (what I believe to be) the first time.  I didn't dig too deeply, but it appears that it can be worked around using pyopenssl.



Discussion:

Resolving patch:
diff --git a/letsencrypt/client/network.py b/letsencrypt/client/network.py
--- a/letsencrypt/client/network.py
+++ b/letsencrypt/client/network.py
@@ -11,6 +11,9 @@
 from letsencrypt.client import errors
 
 
+# https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning
+requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3()
+
 logging.getLogger("requests").setLevel(logging.WARNING)
 
 
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -32,7 +32,9 @@ def read_file(filename, encoding='utf8'):
     'ConfArgParse',
     'jsonschema',
     'mock',
+    'ndg-httpsclient',  # urllib3 InsecurePlatformWarning (#304)
     'psutil>=2.1.0',  # net_connections introduced in 2.1.0
+    'pyasn1',  # urllib3 InsecurePlatformWarning (#304)
     'pycrypto',
     'PyOpenSSL',
     'python-augeas',


Test patch:
Repository: certbot/certbot

Issue:
API docs missing for nginx plugin
API docs for nginx plugin should be found at https://github.com/letsencrypt/lets-encrypt-preview/tree/master/docs/api/client/plugins



Discussion:
I was worried that docs would mislead developers into thinking that the nginx plugin actually works on nginx right now (it won't until DVSNI support is added, hopefully soon). I can add them if that's not an issue.

I actually got confused myself by having nginx plugin merged with `master` already (it should probably go to nginx branch until its working)... Nevertheless, since #351 has been already pulled it, this bug is just a reminder to include the docs at some point. We could leave it until later, but it probably would be best to include it now with a `.. warning:: This plugin is a stub, does not support DVSNI yet!` :)


Resolving patch:
diff --git a/letsencrypt/client/plugins/nginx/configurator.py b/letsencrypt/client/plugins/nginx/configurator.py
--- a/letsencrypt/client/plugins/nginx/configurator.py
+++ b/letsencrypt/client/plugins/nginx/configurator.py
@@ -26,6 +26,8 @@ class NginxConfigurator(object):
     # pylint: disable=too-many-instance-attributes,too-many-public-methods
     """Nginx configurator.
 
+    .. warning:: This plugin is a stub, does not support DVSNI yet!
+
     .. todo:: Add proper support for comments in the config. Currently,
         config files modified by the configurator will lose all their comments.
 


Test patch: