Skip to content

Commit 279d4b4

Browse files
authored
fix: annotate umap weighted edges for mypy (#906)
1 parent e2ee879 commit 279d4b4

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
88
## [Development]
99
<!-- Do Not Erase This Section - Used for tracking unreleased changes -->
1010

11+
### Fixed
12+
- **Mypy**: Declare UMAP mixin weighted-edge DataFrame attributes for type checking.
13+
1114
### Tests
1215
- **Temporal**: Added datetime unit parity coverage (ms/us/ns) for ring layouts, GFQL time ring layouts, and temporal comparison predicates; relaxed honeypot hypergraph datetime unit expectations.
1316

graphistry/umap_utils.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,18 @@
2626

2727
logger = setup_logger(__name__)
2828

29+
DataFrameLike = Union[pd.DataFrame, Any]
30+
2931
if TYPE_CHECKING:
30-
MIXIN_BASE = FeatureMixin
32+
class _UMAPMixinBase(FeatureMixin):
33+
_weighted_edges_df: Optional[DataFrameLike]
34+
_weighted_edges_df_from_nodes: Optional[DataFrameLike]
35+
_weighted_edges_df_from_edges: Optional[DataFrameLike]
36+
37+
MIXIN_BASE = _UMAPMixinBase
3138
else:
3239
MIXIN_BASE = object
3340

34-
35-
DataFrameLike = Union[pd.DataFrame, Any]
36-
3741
# Error message for empty feature matrix
3842
_EMPTY_FEATURES_ERROR_MSG = (
3943
"UMAP requires at least one numeric feature column, but received empty feature matrix. "

0 commit comments

Comments
 (0)