anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: eclipse/kuksa.val
Issue: Paths for kuksa_viss_client

It is not possible to use the ~-operator in the kuksa-viss-client to use the home directory path.
```
Test Client> authorize ~/kuksa.val/kuksa_certificates/jwt/all-read-write.json.token 
{
    "action": "authorize", 
    "error": {
        "message": "Check the JWT token passed", 
        "number": 401, 
        "reason": "Invalid Token"
    }, 
    "requestId": "15388139-03b5-4443-bf3f-2f3e767013f5", 
    "timestamp": "2021-06-14T10:10:46.1623661846Z"
}
```

Changed files:
kuksa_viss_client/__init__.py

diff --git a/kuksa_viss_client/__init__.py b/kuksa_viss_client/__init__.py
index 23fe89b..3f4c06c 100644
--- a/kuksa_viss_client/__init__.py
+++ b/kuksa_viss_client/__init__.py
@@ -63,6 +63,7 @@ class KuksaClientThread(threading.Thread):
     def authorize(self, token=None, timeout = 2):
         if token == None:
             token = self.tokenfile
+        token = os.path.expanduser(token)
         if os.path.isfile(token):
             with open(token, "r") as f:
                 token = f.readline()
Repository: nitrokey/pynitrokey
Issue: secrets: list requires app version 0.4.11

`SecretsApp.list_with_properties` (that is used for the `list` subcommand) requires app version 0.4.11 (firmware version 1.5.0).  Otherwise, the last byte of the credential label is interpreted as the property byte (that is actually not part of the response).

```
$ nitropy nk3 secrets list
Command line tool to interact with Nitrokey devices 0.4.38
Please provide PIN to show PIN-protected entries (if any), or press ENTER to skip
Please touch the device if it blinks
Current PIN (7 attempts left): 
Please touch the device if it blinks
01. HOTP test vecto     Hotp/Sha1       PIN required
02. Tes Totp/Sha1       PWS data available
03. Test        Totp/Sha1       PIN required
04. Test        Totp/Sha1       touch required,PIN required

$ nitropy nk3 update
...
Current firmware version:  v1.4.0
Updated firmware version:  v1.5.0
....

$ nitropy nk3 secrets list
Command line tool to interact with Nitrokey devices 0.4.38
Please provide PIN to show PIN-protected entries (if any), or press ENTER to skip
Please touch the device if it blinks
Current PIN (8 attempts left): 
Please touch the device if it blinks
01. HOTP test vector    Hotp/Sha1
02. Test        Totp/Sha1       PIN required
03. Test2       Totp/Sha1
04. Test3       Totp/Sha1
```

Changed files:
pynitrokey/nk3/secrets_app.py

diff --git a/pynitrokey/nk3/secrets_app.py b/pynitrokey/nk3/secrets_app.py
index 5c36284..922001a 100644
--- a/pynitrokey/nk3/secrets_app.py
+++ b/pynitrokey/nk3/secrets_app.py
@@ -452,7 +452,10 @@ class SecretsApp:
         res = []
         for e in resd:
             # e: tlv8.Entry
-            attribute_byte, label, properties = e.data[0], e.data[1:-1], e.data[-1]
+            if self.feature_extended_list():
+                attribute_byte, label, properties = e.data[0], e.data[1:-1], e.data[-1]
+            else:
+                attribute_byte, label, properties = e.data[0], e.data[1:], 0
             res.append(
                 ListItem(
                     kind=Kind.from_attribute_byte_type(attribute_byte),
@@ -768,6 +771,9 @@ class SecretsApp:
     def feature_pws_support(self) -> bool:
         return self._semver_equal_or_newer("4.11.0")
 
+    def feature_extended_list(self) -> bool:
+        return self._semver_equal_or_newer("4.11.0")
+
     def protocol_v2_confirm_all_requests_with_pin(self) -> bool:
         # 4.7.0 version requires providing PIN each request
         return self.get_feature_status_cached().version_str() == "4.7.0"
Repository: graphnet-team/graphnet
Issue: _transform_prediction_inference not used by I3InferenceModule

**Describe the bug**
_transform_prediction_inference not used by I3InferenceModule. Therefore, predictions are not written to the expected units in cases where the module is loaded with a GNN that has _transform_inference specified.

**Expected behavior**
_transform_prediction_inference should be called.



Changed files:
src/graphnet/deployment/i3modules/graphnet_module.py

diff --git a/src/graphnet/deployment/i3modules/graphnet_module.py b/src/graphnet/deployment/i3modules/graphnet_module.py
index 52797b81..d1fada10 100644
--- a/src/graphnet/deployment/i3modules/graphnet_module.py
+++ b/src/graphnet/deployment/i3modules/graphnet_module.py
@@ -180,6 +180,7 @@ class I3InferenceModule(GraphNeTI3Module):
             )
         else:
             self.model = model
+        self.model.inference()
 
         self.model.to("cpu")
Repository: graphnet-team/graphnet
Issue: AttributeError: Pulse has no attribute ".flags"

**Describe the bug**
Some pulsemaps does not have the `.flags `attribute, meaning that the extraction introduced in #434 fails.



Changed files:
src/graphnet/data/extractors/i3featureextractor.py

diff --git a/src/graphnet/data/extractors/i3featureextractor.py b/src/graphnet/data/extractors/i3featureextractor.py
index 53d3a116..3926b38e 100644
--- a/src/graphnet/data/extractors/i3featureextractor.py
+++ b/src/graphnet/data/extractors/i3featureextractor.py
@@ -148,9 +148,15 @@ class I3FeatureExtractorIceCube86(I3FeatureExtractor):
                 output["is_errata_dom"].append(is_errata_dom)
                 output["event_time"].append(event_time)
                 # Pulse flags
-                output["hlc"].append((pulse.flags >> 0) & 0x1)  # bit 0
-                output["awtd"].append((pulse.flags >> 1) & 0x1)  # bit 1
-                output["fadc"].append((pulse.flags >> 2) & 0x1)  # bit 2
+                flags = getattr(pulse, "flags", padding_value)
+                if flags == padding_value:
+                    output["hlc"].append(padding_value)  # bit 0
+                    output["awtd"].append(padding_value)  # bit 1
+                    output["fadc"].append(padding_value)  # bit 2
+                else:
+                    output["hlc"].append((pulse.flags >> 0) & 0x1)  # bit 0
+                    output["awtd"].append((pulse.flags >> 1) & 0x1)  # bit 1
+                    output["fadc"].append((pulse.flags >> 2) & 0x1)  # bit 2
 
         return output
Repository: graphnet-team/graphnet
Issue: Cannot import SQLite utilities without icetray.

**Describe the bug**
I would like to import a few utility functions from `graphnet.data.sqlite.sqlite_utilities`, but trying to do so results in an error due to icetray not being installed.

**To Reproduce**
Steps to reproduce the behavior:
1. Activate standard graphnet environment in a clean shell
3. Run `$ python -c "from graphnet.data.sqlite.sqlite_utilities import create_table"`
4. See error

**Expected behavior**
I would expect that such generic utility functions should be importable regardless of whether icetray is installed.

**Full traceback**
Please include the full error message to allow for debugging
```
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/lustre/hpc/icecube/asogaard/work/development/graphnet/src/graphnet/data/sqlite/__init__.py", line 5, in <module>
    from .sqlite_dataconverter import SQLiteDataConverter
  File "/lustre/hpc/icecube/asogaard/work/development/graphnet/src/graphnet/data/sqlite/sqlite_dataconverter.py", line 12, in <module>
    from graphnet.data.dataconverter import DataConverter  # type: ignore[attr-defined]
  File "/lustre/hpc/icecube/asogaard/work/development/graphnet/src/graphnet/data/dataconverter.py", line 31, in <module>
    from graphnet.data.extractors import (
  File "/lustre/hpc/icecube/asogaard/work/development/graphnet/src/graphnet/data/extractors/__init__.py", line 3, in <module>
    from .i3extractor import I3Extractor, I3ExtractorCollection
  File "/lustre/hpc/icecube/asogaard/work/development/graphnet/src/graphnet/data/extractors/i3extractor.py", line 10, in <module>
    from icecube import icetray, dataio  # pyright: reportMissingImports=false
ImportError: cannot import name 'icetray' from 'icecube' (unknown location)
```

Changed files:
src/graphnet/utilities/imports.py

diff --git a/src/graphnet/utilities/imports.py b/src/graphnet/utilities/imports.py
index e83050db..b0b69250 100644
--- a/src/graphnet/utilities/imports.py
+++ b/src/graphnet/utilities/imports.py
@@ -10,6 +10,7 @@ def has_icecube_package() -> bool:
     """Check whether the `icecube` package is available."""
     try:
         import icecube  # pyright: reportMissingImports=false
+        from icecube import icetray, dataio
 
         return True
     except ImportError:
Repository: graphnet-team/graphnet
Issue: SQLiteDataconverter fails when extraction from i3 file is empty

**Describe the bug**
SQLiteDataconverter fails when extraction from i3 file is empty. This could be files with no physics frames.

**Expected behavior**
Should just skip these cases and not assert len(data).

**Full traceback**
Please include the full error message to allow for debugging
```
Traceback (most recent call last):
  File "/cvmfs/icecube.opensciencegrid.org/py3-v4.1.1/RHEL_7_x86_64/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/lustre/hpc/hep/pcs557/github/graphnet/src/graphnet/data/dataconverter.py", line 83, in wrapper
    output_file = process_method(self, *args)
  File "/lustre/hpc/hep/pcs557/github/graphnet/src/graphnet/data/dataconverter.py", line 384, in _process_file
    self.save_data(data, output_file)
  File "/lustre/hpc/hep/pcs557/github/graphnet/src/graphnet/data/sqlite/sqlite_dataconverter.py", line 35, in save_data
    assert len(data)
AssertionError
```



Changed files:
src/graphnet/data/sqlite/sqlite_dataconverter.py

diff --git a/src/graphnet/data/sqlite/sqlite_dataconverter.py b/src/graphnet/data/sqlite/sqlite_dataconverter.py
index 94eaef3e..1c73da42 100644
--- a/src/graphnet/data/sqlite/sqlite_dataconverter.py
+++ b/src/graphnet/data/sqlite/sqlite_dataconverter.py
@@ -17,7 +17,7 @@ from graphnet.data.sqlite.sqlite_utilities import (
 
 
 class SQLiteDataConverter(DataConverter):
-    """Class for converting I3-files to SQLite format."""
+    """Class for converting I3-file(s) to SQLite format."""
 
     # Class variables
     file_suffix = "db"
@@ -32,7 +32,14 @@ class SQLiteDataConverter(DataConverter):
             )
 
         # Concatenate data
-        assert len(data)
+        if len(data) == 0:
+            self.warning(
+                "No data was extracted from the processed I3 file(s). "
+                f"No data saved to {output_file}"
+            )
+            return
+
+        saved_any = False
         dataframe = OrderedDict([(key, pd.DataFrame()) for key in data[0]])
         for data_dict in data:
             for key, data_values in data_dict.items():
@@ -51,7 +58,6 @@ class SQLiteDataConverter(DataConverter):
 
         # Save each dataframe to SQLite database
         self.debug(f"Saving to {output_file}")
-        saved_any = False
         for table, df in dataframe.items():
             if len(df) > 0:
                 create_table_and_save_to_sql(
Repository: graphnet-team/graphnet
Issue: TypeError: Can't instantiate abstract class IdentityTask

**Describe the bug**
Similar to #496 but for `IdentityTask`



Changed files:
src/graphnet/models/task/task.py

diff --git a/src/graphnet/models/task/task.py b/src/graphnet/models/task/task.py
index 4bcf4417..094071a7 100644
--- a/src/graphnet/models/task/task.py
+++ b/src/graphnet/models/task/task.py
@@ -265,16 +265,40 @@ class IdentityTask(Task):
     """Identity, or trivial, task."""
 
     @save_model_config
-    def __init__(self, nb_outputs: int, *args: Any, **kwargs: Any):
+    def __init__(
+        self,
+        nb_outputs: int,
+        target_labels: Union[List[str], Any],
+        *args: Any,
+        **kwargs: Any,
+    ):
         """Construct IdentityTask.
 
         Return the `nb_outputs` as a direct, affine transformation of the last
         hidden layer.
         """
         self._nb_inputs = nb_outputs
+        self._default_target_labels = (
+            target_labels
+            if isinstance(target_labels, list)
+            else [target_labels]
+        )
+        self._default_prediction_labels = [
+            f"target_{i}_pred" for i in range(len(self._default_target_labels))
+        ]
 
-        # Base class constructor
         super().__init__(*args, **kwargs)
+        # Base class constructor
+
+    @property
+    def default_target_labels(self) -> List[str]:
+        """Return default target labels."""
+        return self._default_target_labels
+
+    @property
+    def default_prediction_labels(self) -> List[str]:
+        """Return default prediction labels."""
+        return self._default_prediction_labels
 
     @property
     def nb_inputs(self) -> int:
Repository: graphnet-team/graphnet
Issue: AttributeError: Dataset has no self._logger set

**Describe the bug**
In the `__init__`  of `Dataset` references to `self._logger` is made through calls such as `self.warning(msg)`. However, these calls fail with `AttributeError` because the `super().__init__(name=__name__, class_name=self.__class__.__name__)` (which sets the `self._logger` via inheritence to `Logger`) comes **after** these messages are attempted to be sent to the logger.

**To Reproduce**
Steps to reproduce the behavior:
1. Run any training script with `string_selection = [0,1,2,3,4,5]` set for `SQLiteDataset`

**Full traceback**
Please include the full error message to allow for debugging
```
File "/home/iwsatlas1/oersoe/github/graphnet/src/graphnet/data/dataset.py", line 230, in __init__
    self.warning(
  File "/home/iwsatlas1/oersoe/github/graphnet/src/graphnet/utilities/logging.py", line 213, in warning
    return self._logger.warning(msg, *args, **kwargs)
  File "/opt/anaconda3/lib/python3.9/site-packages/torch/utils/data/dataset.py", line 83, in __getattr__
    raise AttributeError
AttributeError
```


Changed files:
src/graphnet/data/dataset.py

diff --git a/src/graphnet/data/dataset.py b/src/graphnet/data/dataset.py
index 25c63569..a0110988 100644
--- a/src/graphnet/data/dataset.py
+++ b/src/graphnet/data/dataset.py
@@ -196,6 +196,9 @@ class Dataset(Logger, Configurable, torch.utils.data.Dataset, ABC):
                 `"10000 random events ~ event_no % 5 > 0"` or `"20% random
                 events ~ event_no % 5 > 0"`).
         """
+        # Base class constructor
+        super().__init__(name=__name__, class_name=self.__class__.__name__)
+
         # Check(s)
         if isinstance(pulsemaps, str):
             pulsemaps = [pulsemaps]
@@ -264,9 +267,6 @@ class Dataset(Logger, Configurable, torch.utils.data.Dataset, ABC):
             seed=seed,
         )
 
-        # Base class constructor
-        super().__init__(name=__name__, class_name=self.__class__.__name__)
-
         # Implementation-specific initialisation.
         self._init()
Repository: graphnet-team/graphnet
Issue: DOMCoarsening with reduce='min' does not work

When specifying `DOMCoarsening(reduce = 'min')`, I run into the following error when batch_size > 1

```
pooled_data: Batch = self._reduce_method(cluster, data)
  File "/home/iwsatlas1/oersoe/github/graphnet/src/graphnet/components/pool.py", line 22, in min_pool
    -data,
TypeError: bad operand type for unary -: 'DataBatch'
```

Seems like the minus sign is defined for `Data` but not `DataBatch` objects.

Changed files:
src/graphnet/components/pool.py

diff --git a/src/graphnet/components/pool.py b/src/graphnet/components/pool.py
index a32b9c60..d58630ca 100644
--- a/src/graphnet/components/pool.py
+++ b/src/graphnet/components/pool.py
@@ -16,16 +16,20 @@ from torch_geometric.nn.pool import (
 
 
 def min_pool(cluster: Any, data: Any, transform: Optional[Any] = None):
-    """Like `max_pool, just negating `data`."""
-    return -max_pool(
+    """Like `max_pool, just negating `data.x`."""
+    data.x = -data.x
+    data_pooled = max_pool(
         cluster,
-        -data,
+        data,
         transform,
     )
+    data.x = -data.x
+    data_pooled.x = -data_pooled.x
+    return data_pooled
 
 
 def min_pool_x(cluster: Any, x: Any, batch: Any, size: Optional[int] = None):
-    """Like `max_pool_x, just negating `data`."""
+    """Like `max_pool_x, just negating `x`."""
     ret = max_pool_x(cluster, -x, batch, size)
     if size is None:
         return (-ret[0], ret[1])
Repository: graphnet-team/graphnet
Issue: Bug in get_even_track_cascade_indicies

Contrary to the other indicies functions, the output of `data.utils.get_even_track_cascade_indicies` is not shuffled properly. 
Most likely, the `events.sample(frac = 1)` in line 143 is meant to shuffle the data, but does nothing instead. 

Reproducible example in the attached .py-file which produces the image also attached, showing the function in question alongside two working functions. 

Tagging @RasmusOrsoe who I believe has written the function

Changed files:
src/graphnet/data/utils.py

diff --git a/src/graphnet/data/utils.py b/src/graphnet/data/utils.py
index 721a3bf4..2ee0225f 100644
--- a/src/graphnet/data/utils.py
+++ b/src/graphnet/data/utils.py
@@ -148,7 +148,7 @@ def get_even_track_cascade_indicies(database):
         query = 'select event_no from truth where abs(pid) != 13 and event_no not in %s'%str(tuple(train_events['event_no']))
         test = pd.read_sql(query, con).values.ravel().tolist()
 
-    return events.values.ravel().tolist(), test
+    return train_events.values.ravel().tolist(), test
 
 def get_even_dbang_selection(db: str, min_max_decay_length = None, seed: int = 42) -> Tuple[List[int]]:
     """Utility method to get indices for neutrino events with equal dbang / non-dbang labels.