Skip to content

Commit 11069e6

Browse files
cthoytdanodonovan
andauthored
🦩🫧 Fixes FunctionResolver type annotations (#1540)
Closes #1539 --------- Co-authored-by: Dan O'Donovan <156329+danodonovan@users.noreply.github.com>
1 parent a8bde13 commit 11069e6

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ dependencies = [
7474
"more_itertools",
7575
"pystow>=0.4.3",
7676
"docdata>=0.0.5",
77-
"class_resolver>=0.5.4",
77+
"class_resolver>=0.6.0",
7878
"pyyaml",
7979
"torch_max_mem>=0.1.4",
8080
"torch-ppr>=0.0.7",

src/pykeen/nn/init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ def __init__(
494494
#: - :func:`pykeen.nn.init.xavier_normal_norm_`
495495
#:
496496
#: as well as initializers from :mod:`torch.nn.init`.
497-
initializer_resolver: FunctionResolver[Initializer] = FunctionResolver(
497+
initializer_resolver: FunctionResolver[[FloatTensor], FloatTensor] = FunctionResolver(
498498
[
499499
getattr(torch.nn.init, func)
500500
for func in dir(torch.nn.init)

src/pykeen/nn/representation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
#: - :func:`complex_normalize`
100100
#: - :func:`torch.clamp`
101101
#: - :func:`clamp_norm`
102-
constrainer_resolver = FunctionResolver(
102+
constrainer_resolver: FunctionResolver[[FloatTensor], FloatTensor] = FunctionResolver(
103103
[functional.normalize, complex_normalize, torch.clamp, clamp_norm],
104104
location="pykeen.nn.representation.constrainer_resolver",
105105
)
@@ -108,7 +108,7 @@
108108
#:
109109
#: - :func:`torch.nn.functional.normalize`
110110
#: - :func:`torch.nn.functional.softmax`
111-
normalizer_resolver = FunctionResolver(
111+
normalizer_resolver: FunctionResolver[[FloatTensor], FloatTensor] = FunctionResolver(
112112
[functional.normalize, functional.softmax],
113113
location="pykeen.nn.representation.normalizer_resolver",
114114
)

src/pykeen/triples/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
Importer = Callable[[str], LabeledTriples]
2727

2828
#: Functions for specifying exotic resources with a given prefix
29-
PREFIX_IMPORTER_RESOLVER: FunctionResolver[Importer] = FunctionResolver.from_entrypoint(
29+
PREFIX_IMPORTER_RESOLVER: FunctionResolver[[str], LabeledTriples] = FunctionResolver.from_entrypoint(
3030
"pykeen.triples.prefix_importer"
3131
)
3232

3333
#: Functions for specifying exotic resources based on their file extension
34-
EXTENSION_IMPORTER_RESOLVER: FunctionResolver[Importer] = FunctionResolver.from_entrypoint(
34+
EXTENSION_IMPORTER_RESOLVER: FunctionResolver[[str], LabeledTriples] = FunctionResolver.from_entrypoint(
3535
"pykeen.triples.extension_importer"
3636
)
3737

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy