Skip to content

Commit

Permalink
only allow to get and set the value of a param using the value property
Browse files Browse the repository at this point in the history
  • Loading branch information
lferraz committed Apr 29, 2023
1 parent 62233b9 commit 922b94c
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 7 deletions.
4 changes: 0 additions & 4 deletions limbus/core/param.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,6 @@ def references(self) -> set[Reference]:
refs = refs.union(ref_set)
return refs

def __call__(self) -> Any:
"""Get the value of the parameter."""
return self.value

@property
def value(self) -> Any:
"""Get the value of the parameter."""
Expand Down
2 changes: 0 additions & 2 deletions tests/core/test_param.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def test_smoke(self):
assert p.arg is None
assert p._is_subscriptable is False
assert p.is_subscriptable is False
assert p() == p.value

def test_subcriptability(self):
p = Param("a", List[torch.Tensor], value=[torch.tensor(1), torch.tensor(1)])
Expand All @@ -136,7 +135,6 @@ def test_init_with_type(self):
def test_init_with_value(self):
p = Param("a", tp=int, value=1)
assert p.value == 1
assert p() == 1

def test_init_with_invalid_value_raise_error(self):
with pytest.raises(TypeError):
Expand Down
1 change: 0 additions & 1 deletion tests/core/test_params.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import pytest
from typing import Any

import torch

Expand Down

0 comments on commit 922b94c

Please sign in to comment.