lenskit/lkpy

View on GitHub

Showing 23 of 957 total issues

ItemList has 40 functions (exceeds 20 allowed). Consider refactoring.
Open

class ItemList:
"""
Representation of a (usually ordered) list of items, possibly with scores
and other associated data; many components take and return item lists. Item
lists are to be treated as **immutable** — create a new list with modified
Severity: Minor
Found in src/lenskit/data/items.py - About 5 hrs to fix

    ItemListCollection has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class ItemListCollection(Generic[KL], ABC):
    """
    A collection of item lists. This protocol defines read access to the
    collection; see :class:`ItemListCollector` for the ability to add new lists.
     
     
    Severity: Minor
    Found in src/lenskit/data/collection/_base.py - About 3 hrs to fix

      Dataset has 26 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Dataset:
      """
      Representation of a data set for LensKit training, evaluation, etc. Data can
      be accessed in a variety of formats depending on the needs of a component.
      See :ref:`data-model` for details of the LensKit data model.
      Severity: Minor
      Found in src/lenskit/data/dataset.py - About 3 hrs to fix

        Function __call__ has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def __call__(self, query: QueryInput, items: ItemList) -> ItemList:
        query = RecQuery.create(query)
        log = _log.bind(user_id=query.user_id, n_items=len(items))
        trace(log, "beginning prediction")
         
         
        Severity: Minor
        Found in src/lenskit/knn/item.py - About 1 hr to fix

          Function train has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def train(self, data: Dataset, options: TrainingOptions = TrainingOptions()):
          """
          Train a FunkSVD model.
           
          Args:
          Severity: Minor
          Found in src/lenskit/funksvd.py - About 1 hr to fix

            Function quick_measure_model has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def quick_measure_model(
            model: Component,
            data: Dataset,
            *,
            predicts_ratings: bool = False,
            Severity: Minor
            Found in src/lenskit/metrics/_quick.py - About 1 hr to fix

              Function __call__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              def __call__(self, query: QueryInput, items: ItemList) -> ItemList:
              """
              Compute predictions for a user and items.
               
              Args:
              Severity: Minor
              Found in src/lenskit/knn/user.py - About 1 hr to fix

                Function score_items_with_neighbors has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                def score_items_with_neighbors(
                log: structlog.stdlib.BoundLogger,
                items: torch.Tensor,
                nbr_rows: torch.Tensor,
                nbr_sims: torch.Tensor,
                Severity: Minor
                Found in src/lenskit/knn/user.py - About 1 hr to fix

                  Function train has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  def train(self, data: Dataset, options: TrainingOptions = TrainingOptions()):
                  """
                  Train a model.
                   
                  The model-training process depends on ``save_nbrs`` and ``min_sim``, but *not* on other
                  Severity: Minor
                  Found in src/lenskit/knn/item.py - About 1 hr to fix

                    Function add_entities has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    def add_entities(
                    self,
                    cls: str,
                    source: IDSequence | pa.Array[Any] | pa.ChunkedArray[Any] | TableInput,
                    *,
                    Severity: Minor
                    Found in src/lenskit/data/builder.py - About 1 hr to fix

                      Avoid deeply nested control flow statements.
                      Open

                      if m.is_decomposed:
                      assert isinstance(m.metric, DecomposedMetric)
                      val = m.metric.compute_list_data(out, list_test)
                      list_intermediates[m.label].append(val)
                      mv = m.metric.extract_list_metric(val)
                      Severity: Major
                      Found in src/lenskit/metrics/bulk.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                        if mv is None and m.is_listwise:
                        mv = m.measure_list(out, list_test)
                        l_row.append(mv)
                        Severity: Major
                        Found in src/lenskit/metrics/bulk.py - About 45 mins to fix

                          Avoid too many return statements within this function.
                          Open

                          return False
                          Severity: Major
                          Found in src/lenskit/pipeline/types.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                            return False
                            Severity: Major
                            Found in src/lenskit/pipeline/types.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                              return NotImplemented
                              Severity: Major
                              Found in src/lenskit/parallel/serialize.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                return cls(user_id=data)
                                Severity: Major
                                Found in src/lenskit/data/query.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                  return get_origin(ct)
                                  Severity: Major
                                  Found in src/lenskit/pipeline/components.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                    return UserRatings(index, ratings, umean)
                                    Severity: Major
                                    Found in src/lenskit/knn/user.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                      return reduce_storage(obj)
                                      Severity: Major
                                      Found in src/lenskit/parallel/serialize.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                        return True
                                        Severity: Major
                                        Found in src/lenskit/pipeline/types.py - About 30 mins to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language