nebius/SWE-bench-extra huggingface dataset:
Repository: sciunto-org/python-bibtexparser

Issue:
Inconsistent results using `bibtexparser.latex_to_unicode`
Thanks for writing and maintaining this package!

I found that using `bibtexparser.latex_to_unicode` yields inconsistent results:

    >>> latex_to_unicode(r"p\^{a}t\'{e}")
    'pâté'
    >>> latex_to_unicode(r"\^{i}le")
    '{î}le'

Why are there braces around i-circumflex but not around a-circumflex or e-acut?

Comments:

Patch:
diff --git a/bibtexparser/latexenc.py b/bibtexparser/latexenc.py
index e225de4..b4ac36d 100644
--- a/bibtexparser/latexenc.py
+++ b/bibtexparser/latexenc.py
@@ -85,6 +85,9 @@ def latex_to_unicode(string):
     # to normalize to the latter.
     cleaned_string = unicodedata.normalize("NFC", "".join(cleaned_string))
 
+    # Remove any left braces
+    cleaned_string = cleaned_string.replace("{", "").replace("}", "")
+
     return cleaned_string
 
 


Test patch:
diff --git a/bibtexparser/tests/test_customization.py b/bibtexparser/tests/test_customization.py
index e38c078..d6d42b5 100644
--- a/bibtexparser/tests/test_customization.py
+++ b/bibtexparser/tests/test_customization.py
@@ -89,7 +89,16 @@ class TestBibtexParserMethod(unittest.TestCase):
         # From issue 121
         record = {'title': '{Two Gedenk\\"uberlieferung der Angelsachsen}'}
         result = convert_to_unicode(record)
-        expected = {'title': '{Two Gedenküberlieferung der Angelsachsen}'}
+        expected = {'title': 'Two Gedenküberlieferung der Angelsachsen'}
+        self.assertEqual(result, expected)
+        # From issue 161
+        record = {'title': r"p\^{a}t\'{e}"}
+        result = convert_to_unicode(record)
+        expected = {'title': "pâté"}
+        self.assertEqual(result, expected)
+        record = {'title': r"\^{i}le"}
+        result = convert_to_unicode(record)
+        expected = {'title': "île"}
         self.assertEqual(result, expected)
 
     ###########
Repository: sciunto-org/python-bibtexparser

Issue:
Implement `__setitem__` on entries
For easier compatiblitiy with (and migration from), we should add a `__setitem__` shorthand on entries, allowing to create new fields and add them to their entry.

Specifically, `myentry["somekey"] = some_value` should create a new field with key `"somekey"` (string type) and value `some_value` (any type), and then add it to the entry using `set_field`




Comments:

Patch:
diff --git a/bibtexparser/model.py b/bibtexparser/model.py
index d3b99be..b53876a 100644
--- a/bibtexparser/model.py
+++ b/bibtexparser/model.py
@@ -318,6 +318,14 @@ class Entry(Block):
             return self.key
         return self.fields_dict[key].value
 
+    def __setitem__(self, key: str, value: Any):
+        """Dict-mimicking index.
+
+        This serves for partial v1.x backwards compatibility,
+        as well as for a shorthand for `set_field`.
+        """
+        self.set_field(Field(key, value))
+
     def items(self):
         """Dict-mimicking, for partial v1.x backwards compatibility.
 


Test patch:
diff --git a/tests/test_model.py b/tests/test_model.py
index a52894e..a2d5c3b 100644
--- a/tests/test_model.py
+++ b/tests/test_model.py
@@ -290,3 +290,24 @@ def test_entry_str():
     )
 
     assert str(entry) == expected
+
+
+def test_entry_fields_shorthand():
+    entry = Entry(
+        entry_type="article",
+        key="myEntry",
+        fields=[
+            Field("myFirstField", "firstValue"),
+            Field("mySecondField", "secondValue"),
+        ],
+    )
+
+    entry["myFirstField"] = "changed_value"
+    assert entry["myFirstField"] == "changed_value"
+    assert entry.fields_dict["myFirstField"].value == "changed_value"
+
+    entry["myNewField"] = "new_value"
+    assert entry["myNewField"] == "new_value"
+    assert entry.fields_dict["myNewField"].key == "myNewField"
+    assert entry.fields_dict["myNewField"].value == "new_value"
+    assert entry.fields_dict["myNewField"].start_line is None
Repository: scottwernervt/favicon

Issue:
AttributeError: 'NoneType' object has no attribute 'lower'
The following tag `<meta content="en-US" data-rh="true" itemprop="inLanguage"/>` causes an exception because it does not have `name` or `proprety` attribute.

```python
Traceback (most recent call last):
  File "/opt/pycharm-professional/helpers/pydev/pydevd.py", line 1664, in <module>
    main()
  File "/opt/pycharm-professional/helpers/pydev/pydevd.py", line 1658, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/opt/pycharm-professional/helpers/pydev/pydevd.py", line 1068, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/opt/pycharm-professional/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/swerner/development/projects/favicon/debug.py", line 3, in <module>
    fav_icons = favicon.get('https://www.nytimes.com/')
  File "/home/swerner/development/projects/favicon/src/favicon/favicon.py", line 69, in get
    link_icons = tags(response.url, response.text)
  File "/home/swerner/development/projects/favicon/src/favicon/favicon.py", line 125, in tags
    if meta_type.lower() == name.lower():
AttributeError: 'NoneType' object has no attribute 'lower'
```

Comments:

Patch:
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index d1cc7ff..f17f3d6 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -1,6 +1,11 @@
 Changelog
 =========
 
+0.5.1 (2018-11-05)
+------------------
+
+* Fix 'NoneType' object has no attribute 'lower' for meta tags (`#16 <https://github.com/scottwernervt/favicon/issues/16>`_).
+
 0.5.0 (2018-11-05)
 ------------------
 
diff --git a/src/favicon/favicon.py b/src/favicon/favicon.py
index cd18532..df5eaf7 100644
--- a/src/favicon/favicon.py
+++ b/src/favicon/favicon.py
@@ -120,9 +120,10 @@ def tags(url, html):
 
     meta_tags = set()
     for meta_tag in soup.find_all('meta', attrs={'content': True}):
-        meta_type = meta_tag.get('name') or meta_tag.get('property')
+        meta_type = meta_tag.get('name') or meta_tag.get('property') or ''
+        meta_type = meta_type.lower()
         for name in META_NAMES:
-            if meta_type.lower() == name.lower():
+            if meta_type == name.lower():
                 meta_tags.add(meta_tag)
 
     icons = set()


Test patch:
diff --git a/tests/test_favicon.py b/tests/test_favicon.py
index 6551313..ffa32c0 100644
--- a/tests/test_favicon.py
+++ b/tests/test_favicon.py
@@ -116,6 +116,15 @@ def test_meta_content_attribute(m, meta_tag):
     assert icons
 
 
+def test_invalid_meta_tag(m):
+    m.head('http://mock.com/favicon.ico', text='Not Found', status_code=404)
+    m.get('http://mock.com/',
+          text='<meta content="en-US" data-rh="true" itemprop="inLanguage"/>')
+
+    icons = favicon.get('http://mock.com/')
+    assert not icons
+
+
 @pytest.mark.parametrize('url,expected', [
     ('http://mock.com/favicon.ico', True),
     ('favicon.ico', False),