Skip to content

Commit

Permalink
add type annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
ganow committed Dec 15, 2023
1 parent bcc1772 commit 6f4c52f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bdpy/dl/torch/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Model definitions."""

from __future__ import annotations

from typing import Dict, Union, Optional, Sequence

Expand Down Expand Up @@ -127,7 +128,7 @@ def _get_value_by_indices(array, indices):
pattern = re.compile(r'^(?P<layer_name>[a-zA-Z_]+[a-zA-Z0-9_]*)?(?P<index>(\[(\d+)\])+)$')
m = pattern.match(layer_name)
if m is not None:
layer_name = m.group('layer_name') # NOTE: layer_name can be None
layer_name: str | None = m.group('layer_name') # NOTE: layer_name can be None
index_str = m.group('index')

indeces = re.findall(r'\[(\d+)\]', index_str)
Expand Down

0 comments on commit 6f4c52f

Please sign in to comment.