Skip to content

[BUG] feature_utils unit tests failing mypy #574

@lmeyerov

Description

@lmeyerov

Describe the bug

Regular PR fails on mypy analysis of feature_utils: https://github.com/graphistry/pygraphistry/actions/runs/9800176651/job/27061697437?pr=573

PyGraphistry API client environment

  • Where run: GHA CI
  • Version: 0.33.8 (main)

Additional context

+ mypy --config-file mypy.ini graphistry
graphistry/feature_utils.py:39: error: Cannot assign to a type  [misc]
graphistry/feature_utils.py:39: error: Incompatible types in assignment (expression has type "object", variable has type "Type[SentenceTransformer]")  [assignment]

=>

SentenceTransformer = Any

on

if TYPE_CHECKING:
    MIXIN_BASE = ComputeMixin
    try:
        from sklearn.pipeline import Pipeline
    except:
        Pipeline = Any
    try:
        from sentence_transformers import SentenceTransformer
    except:
        SentenceTransformer = Any
    try:
        from dirty_cat import (
            SuperVectorizer,
            GapEncoder,
            SimilarityEncoder,
        )
    except:
        SuperVectorizer = Any
        GapEncoder = Any
        SimilarityEncoder = Any
    try:
        from sklearn.preprocessing import FunctionTransformer
        from sklearn.base import BaseEstimator, TransformerMixin
    except:
        FunctionTransformer = Any
        BaseEstimator = object
        TransformerMixin = object
else:
    MIXIN_BASE = object
    Pipeline = Any
    SentenceTransformer = Any
    SuperVectorizer = Any
    GapEncoder = Any
    SimilarityEncoder = Any
    FunctionTransformer = Any
    BaseEstimator = Any
    TransformerMixin = Any

@tanmoyio @mj3cheun @silkspace can one of you take?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions