anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: wright-group/wrighttools
Issue: illegal characters in axis names

WrightTools allows me to create an axis with name `'w2=w1'` but this is not a python recognizable object attribute due to the character `=`. 

This is annoying because the way one generally gets the points of an axis is to write `d.w2.points` but in this case, `d.w2=w1.points` is not allowed by python. So one must resort to `d.axes[0].points`.

Changed files:
WrightTools/data.py, WrightTools/kit.py

diff --git a/WrightTools/data.py b/WrightTools/data.py
index 1d9fa3b..b28f94f 100644
--- a/WrightTools/data.py
+++ b/WrightTools/data.py
@@ -54,7 +54,7 @@ class Axis:
     def __init__(self, points, units, symbol_type=None,
                  tolerance=None, file_idx=None,
                  name='', label_seed=[''], **kwargs):
-        self.name = name
+        self.name = wt_kit.string2identifier(name)
         self.tolerance = tolerance
         self.points = np.asarray(points)
         self.units = units
@@ -157,7 +157,7 @@ class Channel:
     def __init__(self, values, units=None, file_idx=None, null=None, signed=None, name='channel',
                  label=None, label_seed=None):
         # import
-        self.name = name
+        self.name = wt_kit.string2identifier(name)
         self.label = label
         self.label_seed = label_seed
         self.units = units
diff --git a/WrightTools/kit.py b/WrightTools/kit.py
index 49e2924..18ee8dd 100644
--- a/WrightTools/kit.py
+++ b/WrightTools/kit.py
@@ -16,6 +16,7 @@ import copy
 import time
 import pytz
 import h5py
+import string
 import warnings
 import dateutil
 import datetime
@@ -1239,6 +1240,32 @@ def string2array(string, sep='\\t'):
     return arr
 
 
+def string2identifier(s):
+    """Turns a string into a valid python identifier.
+
+    Parameters
+    ----------
+    s : string
+        string to convert
+
+    Returns
+    -------
+    str
+        valid python identifier.
+    """
+    # https://docs.python.org/3/reference/lexical_analysis.html#identifiers
+    if s[0] not in string.ascii_letters:
+        s = '_' + s
+    valids = string.ascii_letters + string.digits + '_'
+    out = ''
+    for i, char in enumerate(s):
+        if char in valids:
+            out += char
+        else:
+            out += '_'
+    return out
+
+
 def string2item(string, sep='\\t'):
     # TODO: document
     if string[0] == '\\'' and string[-1] == '\\'':
Repository: wright-group/wrighttools
Issue: Behavior of wt.artists.set_fig_labels() does not conform to documented or expected behavior

`set_fig_labels` has the kwarg `label_fontsize`, but it doesn't pass this kwarg to the `set_ac_labels` method it calls. This is an easy fix.


Changed files:
WrightTools/artists.py

diff --git a/WrightTools/artists.py b/WrightTools/artists.py
index 91d2e42..af08a7b 100644
--- a/WrightTools/artists.py
+++ b/WrightTools/artists.py
@@ -1101,13 +1101,13 @@ def set_fig_labels(fig=None, xlabel=None, ylabel=None, xticks=None, yticks=None,
     for ax in fig.axes:
         if ax.is_first_col() and ax.is_last_row():
             # lower left corner
-            set_ax_labels(ax=ax, xlabel=xlabel, ylabel=ylabel, xticks=xticks, yticks=yticks)
+            set_ax_labels(ax=ax, xlabel=xlabel, ylabel=ylabel, xticks=xticks, yticks=yticks, label_fontsize=label_fontsize)
         elif ax.is_first_col():
             # lefthand column
-            set_ax_labels(ax=ax, ylabel=ylabel, xticks=False, yticks=yticks)
+            set_ax_labels(ax=ax, ylabel=ylabel, xticks=False, yticks=yticks, label_fontsize=label_fontsize)
         elif ax.is_last_row():
             # bottom row
-            set_ax_labels(ax=ax, xlabel=xlabel, xticks=xticks, yticks=False)
+            set_ax_labels(ax=ax, xlabel=xlabel, xticks=xticks, yticks=False, label_fontsize=label_fontsize)
         else:
             set_ax_labels(ax=ax, xticks=False, yticks=False)
     # title
Repository: sage-bionetworks/schematic
Issue: When use_annotations = T, error is thrown

**Describe the bug**
When using the shiny app configured to retrieve annotations with getModelManifest, app breaks with following error: 

```
Warning: Error in py_call_impl: NameError: name 'syn_store' is not defined

Detailed traceback: 
  File "/home/rallaway/miniconda3/envs/data_curator_env_oauth/lib/python3.7/site-packages/schematic/models/metadata.py", line 149, in getModelManifest
    dataset_id=datasetId, json_schema=jsonSchema, sheet_url=sheetUrl
  File "/home/rallaway/miniconda3/envs/data_curator_env_oauth/lib/python3.7/site-packages/schematic/manifest/generator.py", line 976, in get_manifest
    annotations = syn_store.getDatasetAnnotations(dataset_id)
```
I've omitted the rest of the bug report template for now because I think it's a simple fix and will try and do it now. :)

Changed files:
schematic/manifest/generator.py

diff --git a/schematic/manifest/generator.py b/schematic/manifest/generator.py
index 5dd3e33e..86adb7ae 100644
--- a/schematic/manifest/generator.py
+++ b/schematic/manifest/generator.py
@@ -973,7 +973,7 @@ class ManifestGenerator(object):
             # entities to files and folders (ignoring tables/views)
             annotations = pd.DataFrame()
             if self.is_file_based:
-                annotations = syn_store.getDatasetAnnotations(dataset_id)
+                annotations = store.getDatasetAnnotations(dataset_id)
 
             # Subset columns if no interested in user-defined annotations
             if self.is_file_based and not self.use_annotations:
Repository: sage-bionetworks/schematic
Issue: develop vers of schematic does not return previously submitted manifests

Testing the develop version of the schematic with the data curator app on the dev server here: https://www.synapse.org/#!Wiki:syn20930961/ENTITY and when getting the template previously updated manifests are not returned, an empty new manifest is instead returned. 

Changed files:
schematic/synapse/store.py

diff --git a/schematic/synapse/store.py b/schematic/synapse/store.py
index ca0a9b27..c18ec49c 100644
--- a/schematic/synapse/store.py
+++ b/schematic/synapse/store.py
@@ -240,7 +240,7 @@ class SynapseStorage(object):
         """
 
         # get a list of files containing the manifest for this dataset (if any)
-        manifest = self.getFilesInStorageDataset(datasetId, fileNames = [self.manifest])
+        manifest = self.getFilesInStorageDataset(datasetId, fileNames = [os.path.basename(self.manifest)])
         
         if not manifest:
             return []
Repository: wright-group/wrighttools
Issue: `wt.artists.mpl_2D.plot()` has possibly undesirable behavior RE: filename default

This [line](https://github.com/wright-group/WrightTools/blob/development/WrightTools/artists.py#L2215) raises `AttributeError: 'NoneType' object has no attribute 'endswith'` if nothing is specified by the user for the `fname` kwarg of `wt.artists.mpl_2D.plot()`.

Is the desired workflow that the user _always_ needs to give a filename to `plot` if saving? 

Changed files:
WrightTools/artists.py

diff --git a/WrightTools/artists.py b/WrightTools/artists.py
index 71e9854..d45fca1 100644
--- a/WrightTools/artists.py
+++ b/WrightTools/artists.py
@@ -1901,7 +1901,7 @@ class mpl_2D:
         output_folder : str (optional)
             Output folder.
         fname : str (optional)
-            File name.
+            File name. If None, data name is used. Default is None.
         verbose : bool (optional)
             Toggle talkback. Default is True.
         """
@@ -1912,6 +1912,11 @@ class mpl_2D:
             channel_index = self.chopped[0].channel_names.index(channel)
         else:
             print('channel type not recognized in mpl_2D!')
+        # get fname
+        if fname:
+            pass
+        else:
+            fname = self.data.name
         # prepare figure
         fig = None
         if len(self.chopped) > 10:
@@ -1925,10 +1930,6 @@ class mpl_2D:
             else:
                 if len(self.chopped) == 1:
                     output_folder = os.getcwd()
-                    if fname:
-                        pass
-                    else:
-                        fname = self.data.name
                 else:
                     folder_name = 'mpl_2D ' + wt_kit.get_timestamp(style='short')
                     os.mkdir(folder_name)
Repository: wright-group/wrighttools
Issue: warnings not defined in wt.artists (version 2.13.9)

`File "/home/darien/source/WrightTools/WrightTools/artists.py", line 485, in plot_data`
`warnings.warn(wt_exceptions.VisibleDeprecationWarning(message))`
`NameError: name 'warnings' is not defined`


Changed files:
WrightTools/artists.py

diff --git a/WrightTools/artists.py b/WrightTools/artists.py
index 31f37b5..c46023e 100644
--- a/WrightTools/artists.py
+++ b/WrightTools/artists.py
@@ -32,6 +32,8 @@ import matplotlib.patheffects as PathEffects
 
 import imageio
 
+import warnings
+
 from . import exceptions as wt_exceptions
 from . import data as wt_data
 from . import kit as wt_kit
Repository: wright-group/wrighttools
Issue: axes attr not updated properly

for example, with `convert`

this manifests when saving or copying data

Changed files:
tests/group/save.py, WrightTools/data/_data.py

diff --git a/WrightTools/data/_data.py b/WrightTools/data/_data.py
index dfcc401..0911f2d 100644
--- a/WrightTools/data/_data.py
+++ b/WrightTools/data/_data.py
@@ -205,6 +205,9 @@ class Data(Group):
     def _leaf(self):
         return '{0} {1}'.format(self.natural_name, self.shape)
 
+    def _on_axes_updated(self):
+        self.attrs['axes'] = [a.identity.encode() for a in self._axes]
+
     def _print_branch(self, prefix, level, depth, verbose):
 
         def print_leaves(prefix, lis, vline=True):
@@ -466,6 +469,7 @@ class Data(Group):
 
                     if verbose:
                         print('variable', var.natural_name, 'converted')
+        self._on_axes_updated()
 
     def create_channel(self, name, values=None, units=None, **kwargs):
         """Append a new channel.
@@ -592,7 +596,6 @@ class Data(Group):
         self.transpose(transpose_order, verbose=False)
 
     def flush(self):
-        self.attrs['axes'] = [a.identity.encode() for a in self._axes]
         super().flush()
 
     def get_nadir(self, channel=0):
@@ -1448,6 +1451,7 @@ class Data(Group):
         # finish
         self.flush()
         self._update_natural_namespace()
+        self._on_axes_updated()
 
     def zoom(self, factor, order=1, verbose=True):
         """Zoom the data array using spline interpolation of the requested order.
diff --git a/tests/group/save.py b/tests/group/save.py
index 4b6c24c..9dab949 100644
--- a/tests/group/save.py
+++ b/tests/group/save.py
@@ -121,6 +121,32 @@ def test_simple_save():
     os.remove(p)
 
 
+def test_propagate_units():
+    p = datasets.PyCMDS.wm_w2_w1_001
+    data = wt.data.from_PyCMDS(p)
+    data.convert('eV')
+    p = os.path.join(here, 'units')
+    p = data.save(p)
+    new = wt.open(p)
+    assert new.units == ('eV', 'eV', 'eV')
+    data.close()
+    new.close()
+    os.remove(p)
+
+
+def test_propagate_expressions():
+    p = datasets.PyCMDS.wm_w2_w1_001
+    data = wt.data.from_PyCMDS(p)
+    data.transform(['w1-wm', 'w2', 'w1'])
+    p = os.path.join(here, 'expressions')
+    p = data.save(p)
+    new = wt.open(p)
+    assert data.axis_expressions == new.axis_expressions
+    data.close()
+    new.close()
+    os.remove(p)
+
+
 # --- run -----------------------------------------------------------------------------------------
 
 
@@ -130,3 +156,5 @@ if __name__ == '__main__':
     test_save_nested()
     test_simple_copy()
     test_simple_save()
+    test_propagate_units()
+    test_propagate_expressions()
Repository: wright-group/wrighttools
Issue: wt.artists.Axes.contourf() is broken due to TypeError

`wt.artists.Axes.contourf()` attempts to add a `tuple` and a `list` together when calling `matplotlib.axes.Axes.contour()`. See [this line of code](https://github.com/wright-group/WrightTools/blob/development/WrightTools/artists.py#L126).

Changed files:
WrightTools/artists.py

diff --git a/WrightTools/artists.py b/WrightTools/artists.py
index fc74788..bfd0040 100644
--- a/WrightTools/artists.py
+++ b/WrightTools/artists.py
@@ -121,7 +121,8 @@ class Axes(matplotlib.axes.Axes):
         contours = matplotlib.axes.Axes.contourf(self, *args, **kwargs)  # why can't I use super?
         # fill lines
         zorder = contours.collections[0].zorder - 0.1
-        matplotlib.axes.Axes.contour(self, *(args[:3] + [len(contours.levels)]),
+        levels = (contours.levels[1:] + contours.levels[:-1]) / 2
+        matplotlib.axes.Axes.contour(self, *args[:3], levels=levels,
                                      cmap=contours.cmap,
                                      zorder=zorder)
         # PathCollection modifications
Repository: inveniosoftware/invenio-rdm-records
Issue: review theme module structure

Is the `__init__.py` file needed: I assume yes cuz is a python module. Next question, is the version import needed? I think is not, shall it be removed?

``` python
from ..version import __version__

__all__ = ('__version__', )
```

Changed files:
invenio_rdm_records/theme/__init__.py

diff --git a/invenio_rdm_records/theme/__init__.py b/invenio_rdm_records/theme/__init__.py
index 44c0267..71eaff5 100644
--- a/invenio_rdm_records/theme/__init__.py
+++ b/invenio_rdm_records/theme/__init__.py
@@ -7,7 +7,3 @@
 # it under the terms of the MIT License; see LICENSE file for more details.
 
 """Invenio RDM Records."""
-
-from ..version import __version__
-
-__all__ = ('__version__', )