nebius/SWE-bench-extra huggingface dataset:
Repository: EdinburghGenomics/EGCG-Core

Issue:
rest_communication: post data as form instead of json
`post_entry` should have an option to specify a post where the data is stored in the form instead of the query string.


Comments:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 58a261b..6db3fe5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,10 @@
 Changelog for EGCG-Core
 ===========================
 
-0.8 (unreleased)
+0.7.3 (unreleased)
 ----------------
 
-- Nothing changed yet.
+- Add new option to rest_communication.post_entry to submit payload without json
 
 
 0.7.2 (2017-08-03)
diff --git a/egcg_core/rest_communication.py b/egcg_core/rest_communication.py
index 949e97c..bc78e7d 100644
--- a/egcg_core/rest_communication.py
+++ b/egcg_core/rest_communication.py
@@ -165,9 +165,12 @@ class Communicator(AppLogger):
         else:
             self.warning('No document found in endpoint %s for %s', endpoint, query_args)
 
-    def post_entry(self, endpoint, payload):
+    def post_entry(self, endpoint, payload, use_data=False):
         files, payload = self._detect_files_in_json(payload)
-        return self._req('POST', self.api_url(endpoint), json=payload, files=files)
+        if use_data:
+            return self._req('POST', self.api_url(endpoint), data=payload, files=files)
+        else:
+            return self._req('POST', self.api_url(endpoint), json=payload, files=files)
 
     def put_entry(self, endpoint, element_id, payload):
         files, payload = self._detect_files_in_json(payload)
diff --git a/requirements.txt b/requirements.txt
index b55e6f8..b0f950e 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,7 @@
 pytest>=2.7.2
+requests==2.14.2
 PyYAML>=3.11
 pyclarity_lims>=0.4
 jinja2==2.8
-asana==0.6.2
+asana==0.6.5
 cached_property


Test patch:
diff --git a/tests/test_rest_communication.py b/tests/test_rest_communication.py
index 3f920be..fcc907f 100644
--- a/tests/test_rest_communication.py
+++ b/tests/test_rest_communication.py
@@ -180,6 +180,24 @@ class TestRestCommunication(TestEGCG):
             files={'f': (file_path, b'test content', 'text/plain')}
         )
 
+        self.comm.post_entry(test_endpoint, payload=test_flat_request_content, use_data=True)
+        mocked_response.assert_called_with(
+            'POST',
+            rest_url(test_endpoint),
+            auth=auth,
+            data=test_flat_request_content,
+            files=None
+        )
+
+        self.comm.post_entry(test_endpoint, payload=test_request_content_plus_files, use_data=True)
+        mocked_response.assert_called_with(
+            'POST',
+            rest_url(test_endpoint),
+            auth=auth,
+            data=test_flat_request_content,
+            files={'f': (file_path, b'test content', 'text/plain')}
+        )
+
     @patched_response
     def test_put_entry(self, mocked_response):
         self.comm.put_entry(test_endpoint, 'an_element_id', payload=test_nested_request_content)
Repository: EdinburghGenomics/EGCG-Core

Issue:
Broken recursion in archive_management
In archive_management.register_for_archiving, the recursion is called with the built-in function `filter`, which can only be a typo.

Comments:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f304aea..260484f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,10 +1,10 @@
 Changelog for EGCG-Core
 ===========================
 
-0.8 (unreleased)
+0.7.4 (unreleased)
 ----------------
 
-- Nothing changed yet.
+- Bugfix in archive management.
 
 
 0.7.3 (2017-09-01)
diff --git a/egcg_core/archive_management.py b/egcg_core/archive_management.py
index 58c5eb9..c5f5f2c 100644
--- a/egcg_core/archive_management.py
+++ b/egcg_core/archive_management.py
@@ -95,7 +95,7 @@ def register_for_archiving(file_path, strict=False):
             raise ArchivingError('Registering %s for archiving to tape failed' % file_path)
         # Registering for archive can sometime take time so give it a second
         sleep(1)
-        return register_for_archiving(filter, strict=True)
+        return register_for_archiving(file_path, strict=True)
 
     return True
 


Test patch:
diff --git a/tests/test_archive_management.py b/tests/test_archive_management.py
index 5d45646..0506957 100644
--- a/tests/test_archive_management.py
+++ b/tests/test_archive_management.py
@@ -80,6 +80,16 @@ class TestArchiveManagement(TestEGCG):
             assert get_stdout.call_count == 3
             assert get_stdout.call_args_list[1][0] == ('lfs hsm_archive testfile',)
 
+        with patch('egcg_core.archive_management._get_stdout',
+                   side_effect=[
+                       'testfile: (0x00000001)', '', 'testfile: (0x00000001)',
+                       'testfile: (0x00000001)', '', 'testfile: (0x00000001)',
+                   ]) as get_stdout:
+            self.assertRaises(ArchivingError, register_for_archiving, 'testfile', False)
+            assert get_stdout.call_count == 6
+            assert get_stdout.call_args_list[1][0] == ('lfs hsm_archive testfile',)
+            assert get_stdout.call_args_list[4][0] == ('lfs hsm_archive testfile',)
+
     def test_recall_from_tape(self):
         with patch('egcg_core.archive_management._get_stdout',
                    side_effect=[
Repository: EdinburghGenomics/EGCG-Core

Issue:
Replace (.) dots in user sample name with underscores
Change the sanitize_user_id function to remove dots
https://github.com/EdinburghGenomics/EGCG-Core/blob/f54591f5420dc4b4f8241e080e594a5fd6c5f87a/egcg_core/clarity.py#L114

Comments:

Patch:
diff --git a/egcg_core/clarity.py b/egcg_core/clarity.py
index 0068e9d..39d03f8 100644
--- a/egcg_core/clarity.py
+++ b/egcg_core/clarity.py
@@ -113,7 +113,7 @@ def get_genome_version(sample_id, species=None):
 
 def sanitize_user_id(user_id):
     if isinstance(user_id, str):
-        return re.sub("[^\w_\-.]", "_", user_id)
+        return re.sub("[^\w]", "_", user_id)
 
 
 substitutions = (


Test patch:
diff --git a/tests/test_clarity.py b/tests/test_clarity.py
index c4446fb..271d1d2 100644
--- a/tests/test_clarity.py
+++ b/tests/test_clarity.py
@@ -117,6 +117,7 @@ class TestClarity(TestEGCG):
 
     def test_sanitize_user_id(self):
         assert clarity.sanitize_user_id('this?that$other another:more') == 'this_that_other_another_more'
+        assert clarity.sanitize_user_id('this.that$other another:more') == 'this_that_other_another_more'
 
     def test_get_list_of_samples(self):
         exp_lims_sample_ids = ['this', 'that:01', 'other _L:01']
Repository: EmilStenstrom/conllu

Issue:
Column 'deps' is not being parsed most of the time
Given the following sentence:

```
Removed.
```

The code at `parser.py:152` looks like this:

```python
def parse_paired_list_value(value):
    if fullmatch(MULTI_DEPS_PATTERN, value):
        return [
            (part.split(":", 1)[1], parse_id_value(part.split(":")[0]))
            for part in value.split("|")
        ]

    return parse_nullable_value(value)
```

Is seems like the definition of `MULTI_DEPS_PATTERN` is not correct. Most `deps` values are returned as strings instead of a list of tuples, because the parsing fails. For example `'1:compound|6:ARG1|9:ARG1'` is considered bad, but according to [the specification](https://universaldependencies.org/format.html#syntactic-annotation) this should be alright. Actually the code for parsing inside of the if-statement works perfectly on this line. `'4:ARG1'` is also being considered flawed, but `'5:measure'` is being considered okay.

Comments:

Patch:
diff --git a/conllu/parser.py b/conllu/parser.py
index 16ec94b..7456879 100644
--- a/conllu/parser.py
+++ b/conllu/parser.py
@@ -141,7 +141,7 @@ def parse_id_value(value):
 
 
 ANY_ID = re.compile(ID_SINGLE.pattern + "|" + ID_RANGE.pattern + "|" + ID_DOT_ID.pattern)
-DEPS_RE = re.compile("(" + ANY_ID.pattern + r"):[a-z][a-z_-]*(\:[a-z][a-z_-]*)?")
+DEPS_RE = re.compile("(" + ANY_ID.pattern + r"):[a-zA-Z][a-zA-Z0-9_-]*(\:[a-zA-Z][a-zA-Z0-9_-]*)?")
 MULTI_DEPS_PATTERN = re.compile(r"{}(\|{})*".format(DEPS_RE.pattern, DEPS_RE.pattern))
 
 def parse_paired_list_value(value):


Test patch:
diff --git a/tests/test_parser.py b/tests/test_parser.py
index 0e13a77..2733b58 100644
--- a/tests/test_parser.py
+++ b/tests/test_parser.py
@@ -361,6 +361,14 @@ class TestParsePairedListValue(unittest.TestCase):
             parse_paired_list_value("5:conj:and|8.1:nsubj:pass|9:nsubj:xsubj"),
             [("conj:and", 5), ("nsubj:pass", (8, ".", 1)), ("nsubj:xsubj", 9)]
         )
+        self.assertEqual(
+            parse_paired_list_value("1:compound|6:ARG|9:ARG1|10:ARG2"),
+            [('compound', 1), ('ARG', 6), ('ARG1', 9), ('ARG2', 10)]
+        )
+        self.assertNotEqual(
+            parse_paired_list_value("1:compound|6:ARG|9:ARG1|10:2ARG"),
+            [('compound', 1), ('ARG', 6), ('ARG1', 9), ('2ARG', 10)]
+        )
 
     def test_parse_empty(self):
         testcases = [