Skip to content

Commit

Permalink
Merge pull request #76 from BaseModelAI/introduce-typed-bindings
Browse files Browse the repository at this point in the history
Add types to python bindings.
  • Loading branch information
ponythewhite authored Nov 28, 2024
2 parents 3276934 + cbf8b79 commit 01e380a
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
.idea
cleora-light-rust.iml
*.out
*.so
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pycleora"
version = "2.0.0"
version = "2.1.0"
edition = "2018"
license-file = "LICENSE"
readme = "README.md"
Expand Down
Empty file added pycleora/py.typed
Empty file.
38 changes: 38 additions & 0 deletions pycleora/pycleora.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from typing import Any, Iterable, Optional, Self

import numpy as np
from numpy.typing import NDArray


class SparseMatrix:
def __new__(cls, *args: Any) -> Self:
pass

@classmethod
def from_iterator(
cls, hyperedges: Iterable[str], columns: str, hyperedge_trim_n: int = 16, num_workers: Optional[int] = None
) -> Self:
pass

@classmethod
def from_files(
cls, filepaths: list[str], columns: str, hyperedge_trim_n: int = 16, num_workers: Optional[int] = None
) -> Self:
pass

def left_markov_propagate(self, x: NDArray[np.float32], num_workers: Optional[int] = None) -> NDArray[np.float32]:
pass

def symmetric_markov_propagate(
self, x: NDArray[np.float32], num_workers: Optional[int] = None
) -> NDArray[np.float32]:
pass

def get_entity_column_mask(self, column_name: str) -> NDArray[np.bool]:
pass

def entity_degrees(self) -> NDArray[np.float32]:
pass

def initialize_deterministically(self, feature_dim: int, seed: int = 0) -> NDArray[np.float32]:
pass
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ classifiers = [
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]
version = "2.0.0"
version = "2.1.0"
description = "Sparse hypergraph structure and markov-propagation for node embeddings embeddings exposed via Python bindings."
readme = { file = "README.md", content-type = "text/markdown" }
authors = [
Expand Down

0 comments on commit 01e380a

Please sign in to comment.