brainstate 0.1.0.post20250503__py2.py3-none-any.whl → 0.1.1__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. brainstate/__init__.py +1 -1
  2. brainstate/_compatible_import.py +7 -3
  3. brainstate/_state.py +177 -177
  4. brainstate/_utils.py +0 -1
  5. brainstate/augment/_autograd.py +0 -2
  6. brainstate/augment/_eval_shape.py +0 -2
  7. brainstate/augment/_mapping.py +2 -3
  8. brainstate/augment/_random.py +0 -2
  9. brainstate/compile/_ad_checkpoint.py +0 -2
  10. brainstate/compile/_conditions.py +0 -2
  11. brainstate/compile/_error_if.py +0 -2
  12. brainstate/compile/_jit.py +9 -8
  13. brainstate/compile/_loop_collect_return.py +0 -2
  14. brainstate/compile/_loop_no_collection.py +0 -2
  15. brainstate/compile/_make_jaxpr.py +4 -6
  16. brainstate/compile/_progress_bar.py +0 -1
  17. brainstate/compile/_unvmap.py +0 -1
  18. brainstate/compile/_util.py +0 -2
  19. brainstate/environ.py +0 -2
  20. brainstate/functional/_activations.py +0 -2
  21. brainstate/functional/_normalization.py +0 -2
  22. brainstate/functional/_others.py +0 -2
  23. brainstate/functional/_spikes.py +0 -1
  24. brainstate/graph/_graph_node.py +1 -3
  25. brainstate/graph/_graph_operation.py +4 -2
  26. brainstate/init/_base.py +0 -2
  27. brainstate/init/_generic.py +0 -1
  28. brainstate/init/_random_inits.py +0 -1
  29. brainstate/init/_regular_inits.py +0 -2
  30. brainstate/mixin.py +0 -2
  31. brainstate/nn/_collective_ops.py +0 -3
  32. brainstate/nn/_common.py +0 -2
  33. brainstate/nn/_dyn_impl/_dynamics_neuron.py +0 -2
  34. brainstate/nn/_dyn_impl/_dynamics_synapse.py +0 -1
  35. brainstate/nn/_dyn_impl/_inputs.py +0 -1
  36. brainstate/nn/_dyn_impl/_rate_rnns.py +0 -1
  37. brainstate/nn/_dyn_impl/_readout.py +0 -1
  38. brainstate/nn/_dynamics/_dynamics_base.py +0 -1
  39. brainstate/nn/_dynamics/_projection_base.py +0 -1
  40. brainstate/nn/_dynamics/_state_delay.py +0 -2
  41. brainstate/nn/_dynamics/_synouts.py +0 -2
  42. brainstate/nn/_elementwise/_dropout.py +0 -2
  43. brainstate/nn/_elementwise/_elementwise.py +0 -2
  44. brainstate/nn/_event/_fixedprob_mv.py +0 -1
  45. brainstate/nn/_event/_linear_mv.py +0 -2
  46. brainstate/nn/_exp_euler.py +0 -2
  47. brainstate/nn/_interaction/_conv.py +0 -2
  48. brainstate/nn/_interaction/_embedding.py +0 -1
  49. brainstate/nn/_interaction/_linear.py +0 -2
  50. brainstate/nn/_interaction/_normalizations.py +0 -2
  51. brainstate/nn/_interaction/_poolings.py +0 -2
  52. brainstate/nn/_module.py +0 -1
  53. brainstate/nn/metrics.py +0 -2
  54. brainstate/optim/_base.py +0 -2
  55. brainstate/optim/_lr_scheduler.py +0 -1
  56. brainstate/optim/_optax_optimizer.py +0 -2
  57. brainstate/optim/_sgd_optimizer.py +0 -1
  58. brainstate/random/_rand_funs.py +0 -1
  59. brainstate/random/_rand_seed.py +0 -1
  60. brainstate/random/_rand_state.py +0 -1
  61. brainstate/surrogate.py +0 -1
  62. brainstate/typing.py +0 -2
  63. brainstate/util/_caller.py +4 -6
  64. brainstate/util/_others.py +0 -2
  65. brainstate/util/_pretty_pytree.py +201 -150
  66. brainstate/util/_pretty_repr.py +0 -2
  67. brainstate/util/_pretty_table.py +57 -3
  68. brainstate/util/_scaling.py +0 -2
  69. brainstate/util/_struct.py +0 -2
  70. brainstate/util/filter.py +0 -2
  71. {brainstate-0.1.0.post20250503.dist-info → brainstate-0.1.1.dist-info}/METADATA +11 -5
  72. brainstate-0.1.1.dist-info/RECORD +133 -0
  73. brainstate-0.1.0.post20250503.dist-info/RECORD +0 -133
  74. {brainstate-0.1.0.post20250503.dist-info → brainstate-0.1.1.dist-info}/LICENSE +0 -0
  75. {brainstate-0.1.0.post20250503.dist-info → brainstate-0.1.1.dist-info}/WHEEL +0 -0
  76. {brainstate-0.1.0.post20250503.dist-info → brainstate-0.1.1.dist-info}/top_level.txt +0 -0
@@ -13,7 +13,6 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- from __future__ import annotations
17
16
 
18
17
  __all__ = [
19
18
  'spike_bitwise_or',
@@ -15,8 +15,6 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
- from __future__ import annotations
19
-
20
18
  from abc import ABCMeta
21
19
  from copy import deepcopy
22
20
  from typing import Any, Callable, Type, TypeVar, Tuple, TYPE_CHECKING, Mapping, Iterator, Sequence
@@ -210,7 +208,7 @@ class List(Node):
210
208
  def __len__(self):
211
209
  return len(vars(self))
212
210
 
213
- def __add__(self, other: Sequence[A]) -> List[A]:
211
+ def __add__(self, other: Sequence[A]) -> 'List[A]':
214
212
  return List(list(self) + list(other))
215
213
 
216
214
  def append(self, value):
@@ -18,8 +18,10 @@
18
18
  from __future__ import annotations
19
19
 
20
20
  import dataclasses
21
- from typing import (Any, Callable, Generic, Iterable, Iterator, Mapping, MutableMapping,
22
- Sequence, Type, TypeVar, Union, Hashable, Tuple, Dict, Optional, overload)
21
+ from typing import (
22
+ Any, Callable, Generic, Iterable, Iterator, Mapping, MutableMapping,
23
+ Sequence, Type, TypeVar, Union, Hashable, Tuple, Dict, Optional, overload
24
+ )
23
25
 
24
26
  import jax
25
27
  import numpy as np
brainstate/init/_base.py CHANGED
@@ -13,8 +13,6 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- from __future__ import annotations
17
-
18
16
  from typing import Optional, Tuple
19
17
 
20
18
  import numpy as np
@@ -14,7 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
- from __future__ import annotations
18
17
 
19
18
  from typing import Union, Callable, Optional, Sequence
20
19
 
@@ -14,7 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
- from __future__ import annotations
18
17
 
19
18
  import math
20
19
 
@@ -15,8 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
-
20
18
  import brainunit as u
21
19
 
22
20
  from brainstate import environ
brainstate/mixin.py CHANGED
@@ -15,8 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
-
20
18
  from typing import (Sequence, Optional, TypeVar, _SpecialForm, _type_check, _remove_dups_flatten, _UnionGenericAlias)
21
19
 
22
20
  from brainstate.typing import PyTree
@@ -13,13 +13,10 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- from __future__ import annotations
17
-
18
16
  from collections import namedtuple
19
17
  from typing import Callable, TypeVar, Tuple, Any, Dict
20
18
 
21
19
  import jax
22
- from typing import Callable, TypeVar, Tuple, Any, Dict
23
20
 
24
21
  from brainstate._state import catch_new_states
25
22
  from brainstate._utils import set_module_as
brainstate/nn/_common.py CHANGED
@@ -15,8 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
-
20
18
  from collections import defaultdict
21
19
  from typing import Any, Sequence, Hashable, Dict
22
20
 
@@ -15,8 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
-
20
18
  from typing import Callable, Optional
21
19
 
22
20
  import brainunit as u
@@ -15,7 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
18
 
20
19
  from typing import Optional, Callable
21
20
 
@@ -12,7 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- from __future__ import annotations
16
15
 
17
16
  from typing import Union, Optional, Sequence, Callable
18
17
 
@@ -15,7 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
18
 
20
19
  from typing import Callable, Union
21
20
 
@@ -15,7 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
18
 
20
19
  import numbers
21
20
  from typing import Callable
@@ -32,7 +32,6 @@ For handling the delays:
32
32
  - ``DelayAccess``: The class for the delay access.
33
33
 
34
34
  """
35
- from __future__ import annotations
36
35
 
37
36
  from typing import Any, Dict, Callable, Hashable, Optional, Union, TypeVar, TYPE_CHECKING
38
37
 
@@ -12,7 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- from __future__ import annotations
16
15
 
17
16
  from typing import Union, Callable, Optional
18
17
 
@@ -13,8 +13,6 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- from __future__ import annotations
17
-
18
16
  import math
19
17
  import numbers
20
18
  from functools import partial
@@ -15,8 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
-
20
18
  import brainunit as u
21
19
  import jax.numpy as jnp
22
20
 
@@ -14,8 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
 
17
- from __future__ import annotations
18
-
19
17
  from functools import partial
20
18
  from typing import Optional, Sequence
21
19
 
@@ -15,8 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
-
20
18
  from typing import Optional
21
19
 
22
20
  import brainunit as u
@@ -13,7 +13,6 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- from __future__ import annotations
17
16
 
18
17
  from typing import Union, Callable, Optional
19
18
 
@@ -13,8 +13,6 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- from __future__ import annotations
17
-
18
16
  from typing import Union, Callable, Optional
19
17
 
20
18
  import brainunit as u
@@ -14,8 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
 
17
- from __future__ import annotations
18
-
19
17
  from typing import Callable
20
18
 
21
19
  import brainunit as u
@@ -15,8 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
-
20
18
  import collections.abc
21
19
  from typing import Callable, Tuple, Union, Sequence, Optional, TypeVar
22
20
 
@@ -12,7 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- from __future__ import annotations
16
15
 
17
16
  from typing import Optional, Callable, Union
18
17
 
@@ -15,8 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
-
20
18
  from typing import Callable, Union, Optional
21
19
 
22
20
  import brainunit as u
@@ -15,8 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
-
20
18
  from typing import Callable, Union, Sequence, Optional, Any
21
19
 
22
20
  import jax
@@ -15,8 +15,6 @@
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
17
 
18
- from __future__ import annotations
19
-
20
18
  import functools
21
19
  from typing import Sequence, Optional
22
20
  from typing import Union, Tuple, Callable, List
brainstate/nn/_module.py CHANGED
@@ -25,7 +25,6 @@ The basic classes include:
25
25
  - ``Sequential``: The class for a sequential of modules, which update the modules sequentially.
26
26
 
27
27
  """
28
- from __future__ import annotations
29
28
 
30
29
  import warnings
31
30
  from typing import Sequence, Optional, Tuple, Union, TYPE_CHECKING, Callable
brainstate/nn/metrics.py CHANGED
@@ -14,8 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
 
17
- from __future__ import annotations
18
-
19
17
  import typing as tp
20
18
  from dataclasses import dataclass
21
19
  from functools import partial
brainstate/optim/_base.py CHANGED
@@ -14,8 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
 
17
- from __future__ import annotations
18
-
19
17
  from typing import Dict, Hashable
20
18
 
21
19
  from brainstate._state import State, StateDictManager
@@ -14,7 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
- from __future__ import annotations
18
17
 
19
18
  from typing import Sequence, Union
20
19
 
@@ -14,8 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
 
17
- from __future__ import annotations
18
-
19
17
  import importlib.util
20
18
  from typing import Hashable, Dict, Optional
21
19
 
@@ -14,7 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
- from __future__ import annotations
18
17
 
19
18
  import functools
20
19
  from typing import Union, Dict, Optional, Tuple, Any, TypeVar
@@ -15,7 +15,6 @@
15
15
 
16
16
 
17
17
  # -*- coding: utf-8 -*-
18
- from __future__ import annotations
19
18
 
20
19
  from typing import Optional
21
20
 
@@ -12,7 +12,6 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
- from __future__ import annotations
16
15
 
17
16
  from contextlib import contextmanager
18
17
  from typing import Optional
@@ -14,7 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
- from __future__ import annotations
18
17
 
19
18
  from functools import partial
20
19
  from operator import index
brainstate/surrogate.py CHANGED
@@ -14,7 +14,6 @@
14
14
  # ==============================================================================
15
15
 
16
16
  # -*- coding: utf-8 -*-
17
- from __future__ import annotations
18
17
 
19
18
  import jax
20
19
  import jax.numpy as jnp
brainstate/typing.py CHANGED
@@ -13,8 +13,6 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- from __future__ import annotations
17
-
18
16
  import builtins
19
17
  import functools as ft
20
18
  import importlib
@@ -15,8 +15,6 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
- from __future__ import annotations
19
-
20
18
  import dataclasses
21
19
  from typing import Any, TypeVar, Protocol, Generic
22
20
 
@@ -82,18 +80,18 @@ class CallableProxy:
82
80
  def __call__(self, *args, **kwargs):
83
81
  return self._callable(self._accessor, *args, **kwargs)
84
82
 
85
- def __getattr__(self, name) -> CallableProxy:
83
+ def __getattr__(self, name) -> 'CallableProxy':
86
84
  return CallableProxy(self._callable, getattr(self._accessor, name))
87
85
 
88
- def __getitem__(self, key) -> CallableProxy:
86
+ def __getitem__(self, key) -> 'CallableProxy':
89
87
  return CallableProxy(self._callable, self._accessor[key])
90
88
 
91
89
 
92
90
  class ApplyCaller(Protocol, Generic[A]):
93
- def __getattr__(self, __name) -> ApplyCaller[A]:
91
+ def __getattr__(self, __name) -> 'ApplyCaller[A]':
94
92
  ...
95
93
 
96
- def __getitem__(self, __name) -> ApplyCaller[A]:
94
+ def __getitem__(self, __name) -> 'ApplyCaller[A]':
97
95
  ...
98
96
 
99
97
  def __call__(self, *args, **kwargs) -> tuple[Any, A]:
@@ -13,8 +13,6 @@
13
13
  # limitations under the License.
14
14
  # ==============================================================================
15
15
 
16
- from __future__ import annotations
17
-
18
16
  import copy
19
17
  import functools
20
18
  import gc