original_docstring: Returns a list of data ids, fulfilling the sorting and filtering.
docstring: Returns a list of data ids, fulfilling the sorting and filtering.
docstring_tokens: Returns a list of data ids fulfilling the sorting and filtering .
code: def _filtered_sorted_ids(
          self,
          key_min_value={},
          key_max_value={},
          key_test={},
          sort_key=None,
          reverse=False,
          select_n=None,
      ):
          """Returns a list of data ids, fulfilling the sorting and filtering."""
  
          def combined_filter(computed):
              for key, limit in key_min_value.items():
                  # NOTE: docstring promises >= so using that.
                  # Mathematically could also use < for nicer syntax, but
                  # maybe with some super special weird edge case some one can
                  # depend on the >= operator
                  if computed[key] >= limit:
                      continue
                  return False
              for key, limit in key_max_value.items():
                  if computed[key] <= limit:
                      continue
                  return False
              for key, func in key_test.items():
                  if bool(func(computed[key])):
                      continue
                  return False
              return True
  
          temp_keys = (
              set(key_min_value.keys())
              | set(key_max_value.keys())
              | set(key_test.keys())
              | set([] if sort_key is None else [sort_key])
          )
          filtered_ids = []
          with self.output_keys_as(temp_keys):
              for i, data_id in enumerate(self.data_ids):
                  if select_n is not None and len(filtered_ids) == select_n:
                      break
                  data_point = self.data[data_id]
                  data_point["id"] = data_id
                  computed = self.pipeline.compute_outputs(data_point)
                  if combined_filter(computed):
                      if sort_key is not None:
                          # Add (main sorting index, current index, data_id)
                          # So that we maintain current sorting and don't compare
                          # data_id values ever.
                          filtered_ids.append((computed[sort_key], i, data_id))
                      else:
                          filtered_ids.append(data_id)
          if sort_key is not None:
              filtered_sorted_ids = [
                  tup[2] for tup in sorted(filtered_ids, reverse=reverse)
              ]
          else:
              filtered_sorted_ids = filtered_ids
          return filtered_sorted_ids
code_tokens: def _filtered_sorted_ids ( self , key_min_value = { } , key_max_value = { } , key_test = { } , sort_key = None , reverse = False , select_n = None , ) : def combined_filter ( computed ) : for key , limit in key_min_value . items ( ) : if computed [ key ] >= limit : continue return False for key , limit in key_max_value . items ( ) : if computed [ key ] <= limit : continue return False for key , func in key_test . items ( ) : if bool ( func ( computed [ key ] ) ) : continue return False return True temp_keys = ( set ( key_min_value . keys ( ) ) | set ( key_max_value . keys ( ) ) | set ( key_test . keys ( ) ) | set ( [ ] if sort_key is None else [ sort_key ] ) ) filtered_ids = [ ] with self . output_keys_as ( temp_keys ) : for i , data_id in enumerate ( self . data_ids ) : if select_n is not None and len ( filtered_ids ) == select_n : break data_point = self . data [ data_id ] data_point [ "id" ] = data_id computed = self . pipeline . compute_outputs ( data_point ) if combined_filter ( computed ) : if sort_key is not None : filtered_ids . append ( ( computed [ sort_key ] , i , data_id ) ) else : filtered_ids . append ( data_id ) if sort_key is not None : filtered_sorted_ids = [ tup [ 2 ] for tup in sorted ( filtered_ids , reverse = reverse ) ] else : filtered_sorted_ids = filtered_ids return filtered_sorted_ids
short_docstring: Returns a list of data ids, fulfilling the sorting and filtering.
short_docstring_tokens: Returns a list of data ids fulfilling the sorting and filtering .
comment: """Returns a list of data ids, fulfilling the sorting and filtering."""$SEP$# NOTE: docstring promises >= so using that.$SEP$# Mathematically could also use < for nicer syntax, but$SEP$# maybe with some super special weird edge case some one can$SEP$# depend on the >= operator$SEP$# Add (main sorting index, current index, data_id)$SEP$# So that we maintain current sorting and don't compare$SEP$# data_id values ever.