Skip to content

Commit

Permalink
Remove use of deprecated typing.io (#1855)
Browse files Browse the repository at this point in the history
The typing.io namespace was deprecated in python 3.8, which is the
lowest version currently supported by nbgrader.

https://docs.python.org/3/library/typing.html#aliases-to-other-concrete-types
  • Loading branch information
shreve authored Mar 28, 2024
1 parent 73630d4 commit 720299d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions nbgrader/nbgraderformat/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,13 @@ def validate_nb(self, nb: NotebookNode) -> None:
ids.add(grade_id)


def read_v1(source: typing.io.TextIO, as_version: int, **kwargs: typing.Any) -> NotebookNode:
def read_v1(source: typing.TextIO, as_version: int, **kwargs: typing.Any) -> NotebookNode:
nb = _read(source, as_version, **kwargs)
MetadataValidatorV1().validate_nb(nb)
return nb


def write_v1(nb: NotebookNode, fp: typing.io.TextIO, **kwargs: typing.Any) -> None:
def write_v1(nb: NotebookNode, fp: typing.TextIO, **kwargs: typing.Any) -> None:
MetadataValidatorV1().validate_nb(nb)
_write(nb, fp, **kwargs)

Expand Down
4 changes: 2 additions & 2 deletions nbgrader/nbgraderformat/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ def validate_nb(self, nb: NotebookNode) -> None:
ids.add(grade_id)


def read_v2(source: typing.io.TextIO, as_version: int, **kwargs: typing.Any) -> NotebookNode:
def read_v2(source: typing.TextIO, as_version: int, **kwargs: typing.Any) -> NotebookNode:
nb = _read(source, as_version, **kwargs)
MetadataValidatorV2().validate_nb(nb)
return nb


def write_v2(nb: NotebookNode, fp: typing.io.TextIO, **kwargs: typing.Any) -> None:
def write_v2(nb: NotebookNode, fp: typing.TextIO, **kwargs: typing.Any) -> None:
MetadataValidatorV2().validate_nb(nb)
_write(nb, fp, **kwargs)

Expand Down
4 changes: 2 additions & 2 deletions nbgrader/nbgraderformat/v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ def validate_nb(self, nb: NotebookNode) -> None:
ids.add(grade_id)


def read_v3(source: typing.io.TextIO, as_version: int, **kwargs: typing.Any) -> NotebookNode:
def read_v3(source: typing.TextIO, as_version: int, **kwargs: typing.Any) -> NotebookNode:
nb = _read(source, as_version, **kwargs)
MetadataValidatorV3().validate_nb(nb)
return nb


def write_v3(nb: NotebookNode, fp: typing.io.TextIO, **kwargs: typing.Any) -> None:
def write_v3(nb: NotebookNode, fp: typing.TextIO, **kwargs: typing.Any) -> None:
MetadataValidatorV3().validate_nb(nb)
_write(nb, fp, **kwargs)

Expand Down

0 comments on commit 720299d

Please sign in to comment.