Skip to content

Commit

Permalink
Merge pull request #610 from mit-ll-responsible-ai/bump-pyright-1p1p339
Browse files Browse the repository at this point in the history
pyright compat
  • Loading branch information
rsokl authored Dec 7, 2023
2 parents 9b9898a + 78cbc8a commit e5aae74
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion deps/requirements-pyright.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pyright==1.1.337
pyright==1.1.339
6 changes: 3 additions & 3 deletions docs/source/how_to/use_callbacks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ add them to :ref:`Hydra's config <HydraConf>`.
# Defining our callbacks
class TimeIt(Callback):
def on_job_start(self, **kw) -> None:
def on_job_start(self, **kw) -> None: # type: ignore
self._start = time.time()
def on_job_end(self, **kw) -> None:
def on_job_end(self, **kw) -> None: # type: ignore
print(f"TimeIt: Took {round(time.time() - self._start, 2)} seconds")
class UploadResultsCallback(Callback):
def __init__(self, *, bucket: str = "s3:/") -> None:
self.bucket = bucket
def on_job_end(self, config: Config, **kwargs) -> None:
def on_job_end(self, config: Config, **kwargs) -> None: # type: ignore
# Leverage access to the job's config to create a distinct file path.
path = f"file_{config.x}.txt"
print(f"UploadResultsCallback: Job ended, uploading results to {self.bucket}/{path}")
Expand Down
4 changes: 2 additions & 2 deletions docs/source/tutorials/pytorch_lightning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ following code. Here, we define our single-layer neural network and the `lightni
self.model = model
def forward(self, x):
def forward(self, x): # type: ignore
return self.model(x)
def configure_optimizers(self):
# provide optimizer with model parameters
return self.optim(self.parameters())
def training_step(self, batch, batch_idx):
def training_step(self, batch, batch_idx): # type: ignore
x, y = batch
# compute |cos(x) - model(x)|^2
return F.mse_loss(self.model(x), y)
Expand Down
2 changes: 1 addition & 1 deletion src/hydra_zen/typing/_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ class _Py312Dataclass(_Py311Dataclass, total=False):


class StrictDataclassOptions(_StrictDataclassOptions):
cls_name: Required[str]
cls_name: Required[str] # type: ignore


class DataclassOptions(_Py312Dataclass, total=False):
Expand Down
2 changes: 1 addition & 1 deletion src/hydra_zen/wrapper/_implementations.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
_UNSPECIFIED_: Any = object()


_SUPPORTED_INSTANTIATION_TYPES: Tuple[Any, ...] = (dict, DictConfig, list, ListConfig) # type: ignore
_SUPPORTED_INSTANTIATION_TYPES: Tuple[Any, ...] = (dict, DictConfig, list, ListConfig)

ConfigLike: TypeAlias = Union[
DataClass_,
Expand Down

0 comments on commit e5aae74

Please sign in to comment.