Annotate dunder functions

Summary: Annotate the (return type of the) following dunder functions across the codebase: `__init__()`, `__len__()`, `__getitem__()`

Reviewed By: nikhilaravi

Differential Revision: D29001801

fbshipit-source-id: 928d9e1c417ffe01ab8c0445311287786e997c7c
This commit is contained in:
Patrick Labatut
2021-06-24 15:18:19 -07:00
committed by Facebook GitHub Bot
parent 35855bf860
commit 64289a491d
35 changed files with 79 additions and 79 deletions

View File

@@ -36,7 +36,7 @@ class ListDataset(Dataset):
A simple dataset made of a list of entries.
"""
def __init__(self, entries: List):
def __init__(self, entries: List) -> None:
"""
Args:
entries: The list of dataset entries.
@@ -45,7 +45,7 @@ class ListDataset(Dataset):
def __len__(
self,
):
) -> int:
return len(self._entries)
def __getitem__(self, index):

View File

@@ -22,7 +22,7 @@ class AverageMeter:
Tracks the exact history of the added values in every epoch.
"""
def __init__(self):
def __init__(self) -> None:
"""
Initialize the structure with empty history and zero-ed moving average.
"""
@@ -110,7 +110,7 @@ class Stats:
verbose: bool = False,
epoch: int = -1,
plot_file: Optional[str] = None,
):
) -> None:
"""
Args:
log_vars: The list of variable names to be logged.