anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: lichess4545/heltour
Issue: Closed accounts get rating deleted

This causes issues all over the place as many calls expect that the rating of a player exist as integer value

Changed files:
heltour/tournament/models.py

diff --git a/heltour/tournament/models.py b/heltour/tournament/models.py
index 058471e..c913845 100644
--- a/heltour/tournament/models.py
+++ b/heltour/tournament/models.py
@@ -789,15 +789,17 @@ class Player(_BaseModel):
                                                        new_value=self.account_status)
 
     def update_profile(self, user_meta):
-        self.profile = user_meta
         classical = user_meta.get('perfs', {}).get('classical')
         if classical is not None:
             self.rating = classical['rating']
             self.games_played = classical['games']
-        
         is_closed = user_meta.get('disabled', False)
         is_tosViolation = user_meta.get('tosViolation', False)
         self.account_status = 'closed' if is_closed else 'tos_violation' if is_tosViolation else 'normal'
+        
+        # profile is used to get rating data which should not be updated anymore once an account is closed.
+        if not is_closed:
+            self.profile = user_meta
         self.save()
 
     @classmethod
@@ -827,7 +829,10 @@ class Player(_BaseModel):
     def rating_for(self, league):
         if league:
             if self.profile is None:
-                return None
+                # some admin screens cannot handle a None rating, so we return 0 instead.
+                # self.profile is only None if the player profile has never been downloaded
+                # from lichess or the account had already been closed at that first download.
+                return 0
             return self.profile.get('perfs', {}).get(league.rating_type, {}).get('rating')
         return self.rating
Repository: kevin218/eureka
Issue: Opaque RuntimeWarnings in S3

For reasons that I do not understand, when running Stage 3 I sometimes get many RuntimeWarnings of the type:

> 2022-03-10 14:37:21,622 - stpipe - WARNING - /Users/tjbell1/miniconda3/envs/eureka/lib/python3.9/site-packages/numpy/core/fromnumeric.py:3474: RuntimeWarning: Mean of empty slice.
>   return _methods._mean(a, axis=axis, dtype=dtype,
> 
> 2022-03-10 14:37:21,622 - stpipe - WARNING - /Users/tjbell1/miniconda3/envs/eureka/lib/python3.9/site-packages/numpy/core/_methods.py:189: RuntimeWarning: invalid value encountered in true_divide
>   ret = ret.dtype.type(ret / rcount)

Changed files:
eureka/S3_data_reduction/s3_reduce.py

diff --git a/eureka/S3_data_reduction/s3_reduce.py b/eureka/S3_data_reduction/s3_reduce.py
index 25664391..ca07fb9d 100644
--- a/eureka/S3_data_reduction/s3_reduce.py
+++ b/eureka/S3_data_reduction/s3_reduce.py
@@ -158,7 +158,7 @@ def reduceJWST(eventlabel, ecf_path='./', s2_meta=None):
 
     #check for range of background apertures
     if isinstance(meta.bg_hw, list):
-        meta.bg_hw_range = range(meta.bg_hw[0], meta.bg_hw[1]+meta.spec_hw[2], meta.bg_hw[2])
+        meta.bg_hw_range = range(meta.bg_hw[0], meta.bg_hw[1]+meta.bg_hw[2], meta.bg_hw[2])
     else:
         meta.bg_hw_range = [meta.bg_hw]
 
@@ -239,7 +239,7 @@ def reduceJWST(eventlabel, ecf_path='./', s2_meta=None):
                 istart = 0
             for m in range(istart, meta.num_data_files):
                 # Keep track if this is the first file - otherwise MIRI will keep swapping x and y windows
-                if m==istart:
+                if m==istart and meta.spec_hw==meta.spec_hw_range[0] and meta.bg_hw==meta.bg_hw_range[0]:
                     meta.firstFile = True
                 else:
                     meta.firstFile = False