internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: elastic/ecs

Issue:
[Bug][ECS 1.7] Strip `index` attributes on `wildcard` mappings
**Description of the issue:**

The 1.7 experimental `wildcard` mappings need to have the `index` attribute stripped from them. The one that was causing problems for me is here:

https://github.com/elastic/ecs/blob/3edb6f2cf2c657f88875011625cd1801709c5d5b/experimental/generated/beats/fields.ecs.yml#L1154-L1163

Here's the error I'm getting from Elasticsearch:

```
Failed to parse mapping: unknown parameter [index] on mapper [stack_trace] of type [wildcard]
```



Discussion:

Resolving patch:
diff --git a/scripts/schema/cleaner.py b/scripts/schema/cleaner.py
--- a/scripts/schema/cleaner.py
+++ b/scripts/schema/cleaner.py
@@ -144,6 +144,9 @@ def field_or_multi_field_datatype_defaults(field_details):
         field_details.setdefault('ignore_above', 1024)
     if field_details['type'] == 'text':
         field_details.setdefault('norms', False)
+    # wildcard needs the index param stripped
+    if field_details['type'] == 'wildcard':
+        field_details.pop('index', None)
     if 'index' in field_details and not field_details['index']:
         field_details.setdefault('doc_values', False)
 


Test patch:
diff --git a/scripts/tests/unit/test_schema_cleaner.py b/scripts/tests/unit/test_schema_cleaner.py
--- a/scripts/tests/unit/test_schema_cleaner.py
+++ b/scripts/tests/unit/test_schema_cleaner.py
@@ -223,6 +223,10 @@ def test_field_defaults(self):
         cleaner.field_defaults({'field_details': field_details})
         self.assertEqual(field_details['doc_values'], False)
 
+        field_details = {**field_min_details, **{'type': 'wildcard', 'index': True}}
+        cleaner.field_defaults({'field_details': field_details})
+        self.assertNotIn('index', field_details)
+
     def test_field_defaults_dont_override(self):
         field_details = {
             'description': 'description',
Repository: elastic/ecs

Issue:
Documentation Suggestion: anchor links on ECS fields
This is really pretty simple and I'm not sure where else to properly capture it. 

The existing ECS documentation should have anchor tags on each field name in the ECS guide so you can easily deep-link directly to the relevant field. 

When collaborating, often I'll say "Look at this field(such as rule.id)". I can link the fields [category page](https://www.elastic.co/guide/en/ecs/current/ecs-rule.html), but I can't deep-link directly to the field of discussion. 

Just a small quality of life change that could speed up collaboration. 



Discussion:

Resolving patch:
diff --git a/scripts/schema/finalizer.py b/scripts/schema/finalizer.py
--- a/scripts/schema/finalizer.py
+++ b/scripts/schema/finalizer.py
@@ -176,7 +176,7 @@ def field_finalizer(details, path):
     name_array = path + [details['field_details']['node_name']]
     flat_name = '.'.join(name_array)
     details['field_details']['flat_name'] = flat_name
-    details['field_details']['dashed_name'] = re.sub('[@_\.]', '-', flat_name)
+    details['field_details']['dashed_name'] = re.sub('[_\.]', '-', flat_name).replace('@', '')
     if 'multi_fields' in details['field_details']:
         for mf in details['field_details']['multi_fields']:
             mf['flat_name'] = flat_name + '.' + mf['name']


Test patch:
diff --git a/scripts/tests/unit/test_schema_finalizer.py b/scripts/tests/unit/test_schema_finalizer.py
--- a/scripts/tests/unit/test_schema_finalizer.py
+++ b/scripts/tests/unit/test_schema_finalizer.py
@@ -268,7 +268,7 @@ def test_calculate_final_values(self):
         timestamp_details = base_fields['@timestamp']['field_details']
         self.assertEqual(timestamp_details['flat_name'], '@timestamp',
                          "Field sets with root=true must not namespace field names with the field set's name")
-        self.assertEqual(timestamp_details['dashed_name'], '-timestamp')
+        self.assertEqual(timestamp_details['dashed_name'], 'timestamp')
         # root=false
         self.assertEqual(server_fields['ip']['field_details']['flat_name'], 'server.ip',
                          "Field sets with root=false must namespace field names with the field set's name")
@@ -288,7 +288,7 @@ def test_calculate_final_values(self):
     def test_dashed_name_cleanup(self):
         details = {'field_details': {'node_name': '@time.stamp_'}}
         finalizer.field_finalizer(details, [])
-        self.assertEqual(details['field_details']['dashed_name'], '-time-stamp-')
+        self.assertEqual(details['field_details']['dashed_name'], 'time-stamp-')
 
     # field_group_at_path
Repository: elastic/ecs

Issue:
Incorrect output of the "tracing" fields in the Beats yml file
Just like the `base` fields, the `tracing` fields are not nested under the name of the field set. So it's not `base.@timestamp`, it's `@timestamp`, and it's not `tracing.trace.id`, it's `trace.id`.

In the Beats field yaml file the ECS project generates, the tracing fields are incorrectly nested under a `tracing` section, which means Beats interprets the field names incorrectly (`tracing.trace.id`).

This is a bug, these fields shouldn't be nested this way.

In order to fix this issue, we should remove this nesting in the Beats yml output. Just like `@timestamp` and other base fields are not nested under a field group.

I think this bug fix will be at minimum backported to 1.7. Thoughts welcome on this, is there a need to backport to 1.6 as well?

The Beats PR https://github.com/elastic/beats/pull/22571 to import ECS 1.7 should be adjusted with these changes, once the bug fix is ready. cc @andrewstucki 



Discussion:
@felixbarny I think this one needs to be on your radar as well.

@thomheymann Thanks for helping us find this issue 👍 

Resolving patch:
diff --git a/scripts/generators/beats.py b/scripts/generators/beats.py
--- a/scripts/generators/beats.py
+++ b/scripts/generators/beats.py
@@ -17,6 +17,11 @@ def generate(ecs_nested, ecs_version, out_dir):
             continue
         fieldset = ecs_nested[fieldset_name]
 
+        # Handle when `root:true`
+        if fieldset.get('root', False):
+            beats_fields.extend(fieldset_field_array(fieldset['fields'], df_whitelist, fieldset['prefix']))
+            continue
+
         beats_field = ecs_helpers.dict_copy_keys_ordered(fieldset, allowed_fieldset_keys)
         beats_field['fields'] = fieldset_field_array(fieldset['fields'], df_whitelist, fieldset['prefix'])
         beats_fields.append(beats_field)


Test patch:
Repository: elastic/ecs

Issue:
Remove `ignore_above` setting when not indexing field
Certain ECS fields are type `keyword` but are also not:

* searchable (`index: false`)
* used in aggregations, sorting, or scripting (`doc_values: false`)

The ECS tooling's behavior is to set `ignore_above: 1024` for all `keyword` fields.

However, `ignore_above` should not be present when `index: false` and `doc_values: false` are set on a field.



Discussion:
Identified in https://github.com/elastic/kibana/issues/101232#issuecomment-857863942 and discussed further in https://github.com/elastic/elasticsearch/issues/74121#issuecomment-866653065

Resolving patch:
diff --git a/scripts/schema/cleaner.py b/scripts/schema/cleaner.py
--- a/scripts/schema/cleaner.py
+++ b/scripts/schema/cleaner.py
@@ -153,6 +153,7 @@ def field_or_multi_field_datatype_defaults(field_details):
         field_details.pop('index', None)
     if 'index' in field_details and not field_details['index']:
         field_details.setdefault('doc_values', False)
+        field_details.pop('ignore_above', None)
 
 
 FIELD_MANDATORY_ATTRIBUTES = ['name', 'description', 'type', 'level']


Test patch:
diff --git a/scripts/tests/unit/test_schema_cleaner.py b/scripts/tests/unit/test_schema_cleaner.py
--- a/scripts/tests/unit/test_schema_cleaner.py
+++ b/scripts/tests/unit/test_schema_cleaner.py
@@ -238,6 +238,18 @@ def test_field_defaults_dont_override(self):
         cleaner.field_defaults({'field_details': field_details})
         self.assertEqual(field_details['ignore_above'], 8000)
 
+    def test_field_defaults_index_false_doc_values_false(self):
+        field_details = {
+            'description': 'description',
+            'level': 'extended',
+            'name': 'my_non_indexed_field',
+            'type': 'keyword',
+            'index': False,
+            'doc_values': False
+        }
+        cleaner.field_defaults({'field_details': field_details})
+        self.assertNotIn("ignore_above", field_details)
+
     def test_multi_field_defaults_and_precalc(self):
         field_details = {
             'description': 'description',
Repository: LMFDB/lmfdb

Issue:
missing link to Dirichlet L function from Dirichlet character page
this is my fault, I have to restore the link.
Pascal



Discussion:

Resolving patch:
diff --git a/lmfdb/WebCharacter.py b/lmfdb/WebCharacter.py
--- a/lmfdb/WebCharacter.py
+++ b/lmfdb/WebCharacter.py
@@ -639,13 +639,15 @@ def properties2(self):
     @property
     def friends(self):
         f = []
+        cglink = url_character(type=self.type,number_field=self.nflabel,modulus=self.modlabel)
+        f.append( ("Character group", cglink) )
         if self.nflabel:
-           cglink = '/Character/%s/%s/%s'%(self.type,self.nflabel,self.modlabel)
-           f.append( ("Character group", cglink) )
-           f.append( ('Number Field', '/NumberField/' + self.nflabel) )
-        else:
-           cglink = '/Character/%s/%s'%(self.type,self.modlabel)
-           f.append( ("Character group", cglink) )
+            f.append( ('Number Field', '/NumberField/' + self.nflabel) )
+        if self.type == 'Dirichlet':
+            f.append( ('L function', '/L'+ url_character(type=self.type,
+                                    number_field=self.nflabel,
+                                    modulus=self.modlabel,
+                                    number=self.numlabel) ) )
         f.append( ("Value Field", '/NumberField/' + self.vflabel) )
         return f
 


Test patch:
Repository: LMFDB/lmfdb

Issue:
Server error
http://www.lmfdb.org/ModularForm/GL2/Q/holomorphic/7/7/5/ causes an Server Error.
In fact, all pages of spaces that are not in the db but have Galois conjugates in the db, cause this error.



Discussion:

Resolving patch:
diff --git a/lmfdb/modular_forms/elliptic_modular_forms/backend/web_newforms.py b/lmfdb/modular_forms/elliptic_modular_forms/backend/web_newforms.py
--- a/lmfdb/modular_forms/elliptic_modular_forms/backend/web_newforms.py
+++ b/lmfdb/modular_forms/elliptic_modular_forms/backend/web_newforms.py
@@ -397,6 +397,8 @@ def coefficients(self, nrange=range(1, 10), save_to_db=False):
          We assume that the self._ap containing Hecke eigenvalues
          are stored.
         """
+        if len(nrange) == 0:
+            return []
         if len(nrange) > 1:
             emf_logger.debug("computing coeffs in range {0}--{1}".format(nrange[0],nrange[1]))
         else:
@@ -442,6 +444,8 @@ def coefficient_n_recursive(self, n):
         prod = K(1)
         if K.absolute_degree()>1 and K.is_relative():
             KZ = K.base_field()
+        else:
+            KZ = K
         #emf_logger.debug("K= {0}".format(K))
         F = arith.factor(n)
         for p, r in F:
diff --git a/lmfdb/modular_forms/elliptic_modular_forms/views/emf_render_web_modform_space.py b/lmfdb/modular_forms/elliptic_modular_forms/views/emf_render_web_modform_space.py
--- a/lmfdb/modular_forms/elliptic_modular_forms/views/emf_render_web_modform_space.py
+++ b/lmfdb/modular_forms/elliptic_modular_forms/views/emf_render_web_modform_space.py
@@ -91,7 +91,7 @@ def set_info_for_modular_form_space(level=None, weight=None, character=None, lab
         info['error'] = "Got wrong level: %s " % level
         return info
     try:
-        WMFS = WebModFormSpace_cached(level = level, weight = weight, cuspidal=True,character = character,update_from_db=True)
+        WMFS = WebModFormSpace_cached(level = level, weight = weight, cuspidal=True, character = character, update_from_db=True)
         if not WMFS.has_updated():
             stop = False
             orbit = WMFS.character.character.galois_orbit()
@@ -103,9 +103,8 @@ def set_info_for_modular_form_space(level=None, weight=None, character=None, lab
                 if c.number() == WMFS.character.number:
                     continue
                 print c.number()
-                WMFS_rep = WebModFormSpace_cached(level = level, weight = weight, cuspidal=True, character = c.number(),update_from_db=true)
+                WMFS_rep = WebModFormSpace_cached(level = level, weight = weight, cuspidal=True, character = c.number(), update_from_db=True)
                 if WMFS_rep.has_updated_from_db():
-                    print "Here"
                     stop = True
                     info['wmfs_rep_url'] = url_for('emf.render_elliptic_modular_forms', level=level, weight=weight, character = c.number())
                     info['wmfs_rep_number'] =  c.number()


Test patch:
Repository: LMFDB/lmfdb

Issue:
Simplify character value
In the table near the top of

http://beta.lmfdb.org/Character/Dirichlet/20/3

e(5/4) should be  i



Discussion:
I'm working on this. Pascal


Resolving patch:
diff --git a/lmfdb/WebCharacter.py b/lmfdb/WebCharacter.py
--- a/lmfdb/WebCharacter.py
+++ b/lmfdb/WebCharacter.py
@@ -149,8 +149,8 @@ def texlogvalue(x, tag=False):
             return 0
         if not isinstance(x, Rational):
             return '1'
-        n = int(x.numer())
         d = int(x.denom())
+        n = int(x.numer())  % d # should be fixed in Dirichlet_conrey
         if d == 1:
             return '1'
         elif n == 1 and d == 2:


Test patch:
Repository: LMFDB/lmfdb

Issue:
Bug when trying to download certain search results for elliptic curves over Q
After searching for elliptic curves with 4-torsion and non-surjective mod 19 image, clicking on the button to download results into sage or magma produces this error:

The page you are looking for has produced a server error.
If you want to help improving the page behind "http://www.lmfdb.org/EllipticCurve/Q/?start=0&conductor=&jinv=&rank=&torsion=4&torsion_structure=&sha=&optimal=&surj_primes=&surj_quantifier=include&nonsurj_primes=19&count=100", please report that page's URL!

Interestingly, if you change 4-torsion to 6-torsion it works



Discussion:

Resolving patch:
diff --git a/lmfdb/elliptic_curves/elliptic_curve.py b/lmfdb/elliptic_curves/elliptic_curve.py
--- a/lmfdb/elliptic_curves/elliptic_curve.py
+++ b/lmfdb/elliptic_curves/elliptic_curve.py
@@ -241,11 +241,6 @@ def elliptic_curve_search(**args):
         query['number'] = 1
 
     info['query'] = query
-
-    if 'download' in info and info['download'] != '0':
-        res = db_ec().find(query).sort([ ('conductor', ASCENDING), ('iso_nlabel', ASCENDING), ('lmfdb_number', ASCENDING) ])
-        return download_search(info, res)
-
     cursor = db_ec().find(query)
     nres = cursor.count()
     if(start >= nres):
@@ -262,6 +257,9 @@ def elliptic_curve_search(**args):
     info['start'] = start
     info['count'] = count
     info['more'] = int(start + count < nres)
+
+    if 'download' in info and info['download'] != '0':
+        return download_search(info)
     if nres == 1:
         info['report'] = 'unique match'
     elif nres == 2:
@@ -271,7 +269,6 @@ def elliptic_curve_search(**args):
             info['report'] = 'displaying matches %s-%s of %s' % (start + 1, min(nres, start + count), nres)
         else:
             info['report'] = 'displaying all %s matches' % nres
-
     credit = 'John Cremona'
     if 'non-surjective_primes' in query:
         credit += 'and Andrew Sutherland'
@@ -538,7 +535,7 @@ def download_EC_all(label):
     return response
 
 
-def download_search(info, res):
+def download_search(info):
     dltype = info['Submit']
     delim = 'bracket'
     com = r'\\'  # single line comment start
@@ -556,7 +553,7 @@ def download_search(info, res):
         delim = 'magma'
         filename = 'elliptic_curves.m'
     s = com1 + "\n"
-    s += com + ' Elliptic curves downloaded from the LMFDB downloaded %s\n'% mydate
+    s += com + ' Elliptic curves downloaded from the LMFDB downloaded on %s. Found %s curves.\n'%(mydate, info['curves'].count())
     s += com + ' Below is a list called data. Each entry has the form:\n'
     s += com + '   [Weierstrass Coefficients]\n'
     s += '\n' + com2
@@ -566,7 +563,8 @@ def download_search(info, res):
     else:
         s += 'data = ['
     s += '\\\n'
-    for f in res:
+    #for f in info['curves']:
+    for f in info['curves']:
         entry = str(f['ainvs'])
         entry = entry.replace('u','')
         entry = entry.replace('\'','')


Test patch:
Repository: LMFDB/lmfdb

Issue:
Elliptic curve shows wrong modular form label
The elliptic curve page http://beta.lmfdb.org/EllipticCurve/Q/37/a/1 correctly links to the modular form http://beta.lmfdb.org/ModularForm/GL2/Q/holomorphic/37/2/1/a/, but the text of the link is "Modular form 37.2a" instead of "Modular form 37.2.1a".



Discussion:
Ok, I'll fix that when I get back to Bristol
On 29 Mar 2016 01:16, "kedlaya" notifications@github.com wrote:

> The elliptic curve page http://beta.lmfdb.org/EllipticCurve/Q/37/a/1
> correctly links to the modular form
> http://beta.lmfdb.org/ModularForm/GL2/Q/holomorphic/37/2/1/a/, but the
> text of the link is "Modular form 37.2a" instead of "Modular form 37.2.1a".
> 
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly or view it on GitHub
> https://github.com/LMFDB/lmfdb/issues/877

OK, I made the MF label by replacing "." by ".2" and it should be ".2.1"


Resolving patch:
diff --git a/lmfdb/elliptic_curves/web_ec.py b/lmfdb/elliptic_curves/web_ec.py
--- a/lmfdb/elliptic_curves/web_ec.py
+++ b/lmfdb/elliptic_curves/web_ec.py
@@ -324,7 +324,7 @@ def make_curve(self):
             ('L-function', url_for("l_functions.l_function_ec_page", label=self.lmfdb_label)),
             ('Symmetric square L-function', url_for("l_functions.l_function_ec_sym_page", power='2', label=self.lmfdb_iso)),
             ('Symmetric 4th power L-function', url_for("l_functions.l_function_ec_sym_page", power='4', label=self.lmfdb_iso)),
-            ('Modular form ' + self.lmfdb_iso.replace('.', '.2'), url_for("emf.render_elliptic_modular_forms", level=int(N), weight=2, character=1, label=iso))]
+            ('Modular form ' + self.lmfdb_iso.replace('.', '.2.1'), url_for("emf.render_elliptic_modular_forms", level=int(N), weight=2, character=1, label=iso))]
 
         self.downloads = [('Download coefficients of q-expansion', url_for(".download_EC_qexp", label=self.lmfdb_label, limit=100)),
                           ('Download all stored data', url_for(".download_EC_all", label=self.lmfdb_label))]


Test patch:
Repository: LMFDB/lmfdb

Issue:
j-invariant search for elliptic curve over number field broken
Reported through feedback page:

Start at http://www.lmfdb.org/EllipticCurve/2.0.3.1/

Enter 0 or 1 for the j-invariant and search again, crash.

When fixed reply to fnajman@math.hr



Discussion:
It's just a missing import in search_parsing.py.  PR coming up.


Resolving patch:
diff --git a/lmfdb/search_parsing.py b/lmfdb/search_parsing.py
--- a/lmfdb/search_parsing.py
+++ b/lmfdb/search_parsing.py
@@ -14,7 +14,7 @@
 FLOAT_RE = re.compile(r'((\b\d+([.]\d*)?)|([.]\d+))(e[-+]?\d+)?')
 
 from flask import flash, redirect, url_for, request
-from sage.all import ZZ, QQ, prod, euler_phi, CyclotomicField
+from sage.all import ZZ, QQ, prod, euler_phi, CyclotomicField, PolynomialRing
 from sage.misc.decorators import decorator_keywords
 
 from markupsafe import Markup


Test patch:
Repository: LMFDB/lmfdb

Issue:
Funny slider behavior on Dirichlet character pages.
Go to http://beta.lmfdb.org/Character/Dirichlet/28/23 and drag the slider under Jacobi characters to the right beyond about halfway. As you drag the slider the number 1 appears in the equation at all times, even as the box says something more realistic. For $n=25$ we get an error saying n must be coprime to the modulus.



Discussion:
I'll look at it

@pascalmolin : Still broken, any updates?

Forgot it: I am taking a look.

2016-05-01 20:47 GMT+02:00 jvoight notifications@github.com:

> @pascalmolin https://github.com/pascalmolin : Still broken, any updates?
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly or view it on GitHub
> https://github.com/LMFDB/lmfdb/issues/626#issuecomment-216063566


Resolving patch:
diff --git a/lmfdb/WebCharacter.py b/lmfdb/WebCharacter.py
--- a/lmfdb/WebCharacter.py
+++ b/lmfdb/WebCharacter.py
@@ -1132,7 +1132,9 @@ def codegauss(self):
 
     def jacobi_sum(self, val):
         mod, num = self.modulus, self.number
-        val = int(val[0])
+        val = int(val)
+        if gcd(mod, val) > 1:
+            raise Warning ("n must be prime to modulus = %s"%mod)
         psi = self.H[val]
         chi = self.chi.sage_character()
         psi = psi.sage_character()
diff --git a/lmfdb/characters/main.py b/lmfdb/characters/main.py
--- a/lmfdb/characters/main.py
+++ b/lmfdb/characters/main.py
@@ -197,8 +197,10 @@ def dc_calc(calc, modulus, number):
             return WebDirichletCharacter(**args).kloosterman_sum(val)
         else:
             return flask.abort(404)
-    except Exception, e:
-        return "<span style='color:red;'>ERROR: %s</span>" % e
+    except Warning, e:
+        return "<span style='color:gray;'>%s</span>" % e
+    except Exception:
+        return "<span style='color:red;'>Error: bad input</span>"
 
 @characters_page.route("/Hecke/")
 @characters_page.route("/Hecke/<number_field>")


Test patch:
Repository: LMFDB/lmfdb

Issue:
Funny slider behavior on Dirichlet character pages.
Go to http://beta.lmfdb.org/Character/Dirichlet/28/23 and drag the slider under Jacobi characters to the right beyond about halfway. As you drag the slider the number 1 appears in the equation at all times, even as the box says something more realistic. For $n=25$ we get an error saying n must be coprime to the modulus.



Discussion:
I'll look at it

@pascalmolin : Still broken, any updates?

Forgot it: I am taking a look.

2016-05-01 20:47 GMT+02:00 jvoight notifications@github.com:

> @pascalmolin https://github.com/pascalmolin : Still broken, any updates?
> 
> —
> You are receiving this because you were mentioned.
> Reply to this email directly or view it on GitHub
> https://github.com/LMFDB/lmfdb/issues/626#issuecomment-216063566


Resolving patch:
diff --git a/lmfdb/WebCharacter.py b/lmfdb/WebCharacter.py
--- a/lmfdb/WebCharacter.py
+++ b/lmfdb/WebCharacter.py
@@ -1132,7 +1132,9 @@ def codegauss(self):
 
     def jacobi_sum(self, val):
         mod, num = self.modulus, self.number
-        val = int(val[0])
+        val = int(val)
+        if gcd(mod, val) > 1:
+            raise Warning ("n must be coprime to the modulus : %s"%mod)
         psi = self.H[val]
         chi = self.chi.sage_character()
         psi = psi.sage_character()
diff --git a/lmfdb/characters/main.py b/lmfdb/characters/main.py
--- a/lmfdb/characters/main.py
+++ b/lmfdb/characters/main.py
@@ -197,8 +197,10 @@ def dc_calc(calc, modulus, number):
             return WebDirichletCharacter(**args).kloosterman_sum(val)
         else:
             return flask.abort(404)
-    except Exception, e:
-        return "<span style='color:red;'>ERROR: %s</span>" % e
+    except Warning, e:
+        return "<span style='color:gray;'>%s</span>" % e
+    except Exception:
+        return "<span style='color:red;'>Error: bad input</span>"
 
 @characters_page.route("/Hecke/")
 @characters_page.route("/Hecke/<number_field>")


Test patch: