Skip to content

Commit

Permalink
Sequence -> list in some type hints/declarations for simplicity
Browse files Browse the repository at this point in the history
  • Loading branch information
ulupo committed May 10, 2024
1 parent ebb160c commit 321b623
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 30 deletions.
6 changes: 2 additions & 4 deletions diffpass/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,8 @@
GroupByGroupList = list # List indexed by group index

IndexPair = tuple[int, int] # Pair of indices
IndexPairsInGroup = Sequence[IndexPair] # Pairs of indices in a group of sequences
IndexPairsInGroups = Sequence[
IndexPairsInGroup
] # Pairs of indices in groups of sequences
IndexPairsInGroup = list[IndexPair] # Pairs of indices in a group of sequences
IndexPairsInGroups = list[IndexPairsInGroup] # Pairs of indices in groups of sequences

# %% ../nbs/base.ipynb 6
def dccn(x: torch.Tensor) -> np.ndarray:
Expand Down
6 changes: 2 additions & 4 deletions diffpass/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@

# Type aliases
IndexPair = tuple[int, int] # Pair of indices
IndexPairsInGroup = Sequence[IndexPair] # Pairs of indices in a group of sequences
IndexPairsInGroups = Sequence[
IndexPairsInGroup
] # Pairs of indices in groups of sequences
IndexPairsInGroup = list[IndexPair] # Pairs of indices in a group of sequences
IndexPairsInGroups = list[IndexPairsInGroup] # Pairs of indices in groups of sequences

# %% ../nbs/model.ipynb 6
def _consecutive_slices_from_sizes(group_sizes: Optional[Sequence[int]]) -> list[slice]:
Expand Down
6 changes: 2 additions & 4 deletions diffpass/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,8 @@

# Type aliases
IndexPair = tuple[int, int] # Pair of indices
IndexPairsInGroup = Sequence[IndexPair] # Pairs of indices in a group of sequences
IndexPairsInGroups = Sequence[
IndexPairsInGroup
] # Pairs of indices in groups of sequences
IndexPairsInGroup = list[IndexPair] # Pairs of indices in a group of sequences
IndexPairsInGroups = list[IndexPairsInGroup] # Pairs of indices in groups of sequences

# %% ../nbs/train.ipynb 6
class InformationPairing(DiffPaSSModel):
Expand Down
10 changes: 4 additions & 6 deletions nbs/base.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,8 @@
"GroupByGroupList = list # List indexed by group index\n",
"\n",
"IndexPair = tuple[int, int] # Pair of indices\n",
"IndexPairsInGroup = Sequence[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = Sequence[\n",
" IndexPairsInGroup\n",
"] # Pairs of indices in groups of sequences"
"IndexPairsInGroup = list[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = list[IndexPairsInGroup] # Pairs of indices in groups of sequences"
]
},
{
Expand All @@ -98,8 +96,8 @@
"GroupByGroupList = list # List indexed by group index\n",
"\n",
"IndexPair = tuple[int, int] # Pair of indices\n",
"IndexPairsInGroup = Sequence[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = Sequence[IndexPairsInGroup] # Pairs of indices in groups of sequences\n",
"IndexPairsInGroup = list[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = list[IndexPairsInGroup] # Pairs of indices in groups of sequences\n",
"```"
]
},
Expand Down
10 changes: 4 additions & 6 deletions nbs/model.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,8 @@
"\n",
"# Type aliases\n",
"IndexPair = tuple[int, int] # Pair of indices\n",
"IndexPairsInGroup = Sequence[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = Sequence[\n",
" IndexPairsInGroup\n",
"] # Pairs of indices in groups of sequences"
"IndexPairsInGroup = list[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = list[IndexPairsInGroup] # Pairs of indices in groups of sequences"
]
},
{
Expand All @@ -95,8 +93,8 @@
"## Type aliases\n",
"```python\n",
"IndexPair = tuple[int, int] # Pair of indices\n",
"IndexPairsInGroup = Sequence[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = Sequence[IndexPairsInGroup] # Pairs of indices in groups of sequences\n",
"IndexPairsInGroup = list[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = list[IndexPairsInGroup] # Pairs of indices in groups of sequences\n",
"```"
]
},
Expand Down
10 changes: 4 additions & 6 deletions nbs/train.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,8 @@
"\n",
"# Type aliases\n",
"IndexPair = tuple[int, int] # Pair of indices\n",
"IndexPairsInGroup = Sequence[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = Sequence[\n",
" IndexPairsInGroup\n",
"] # Pairs of indices in groups of sequences"
"IndexPairsInGroup = list[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = list[IndexPairsInGroup] # Pairs of indices in groups of sequences"
]
},
{
Expand All @@ -87,8 +85,8 @@
"\n",
"```python\n",
"IndexPair = tuple[int, int] # Pair of indices\n",
"IndexPairsInGroup = Sequence[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = Sequence[IndexPairsInGroup] # Pairs of indices in groups of sequences\n",
"IndexPairsInGroup = list[IndexPair] # Pairs of indices in a group of sequences\n",
"IndexPairsInGroups = list[IndexPairsInGroup] # Pairs of indices in groups of sequences\n",
"```"
]
},
Expand Down

0 comments on commit 321b623

Please sign in to comment.