Skip to content

Replace obsolete import contextlib2 with the equivalent stdlib module contextlib #298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions sonnet/src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ snt_py_library(
srcs = ["custom_getter.py"],
deps = [
":base",
# pip: contextlib2
# pip: tensorflow
# pip: tree
],
Expand Down Expand Up @@ -637,7 +636,6 @@ snt_py_library(
deps = [
":custom_getter",
":utils",
# pip: contextlib2
# pip: tensorflow
# pip: tree
],
Expand Down
2 changes: 1 addition & 1 deletion sonnet/src/custom_getter.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
# ============================================================================
"""Custom getter for module members."""

import contextlib
from typing import Any, Callable, ContextManager, Iterable, Optional, Type

import contextlib
from sonnet.src import base
import tensorflow as tf
import tree
Expand Down
1 change: 0 additions & 1 deletion sonnet/src/distribute/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ snt_py_library(
srcs = ["replicator.py"],
deps = [
# pip: absl/logging
# pip: contextlib2
"//sonnet/src:initializers",
# pip: tensorflow
],
Expand Down
2 changes: 1 addition & 1 deletion sonnet/src/distribute/replicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
# ============================================================================
"""Replicator Distribution Strategy."""

import contextlib
from typing import Callable, TypeVar

from absl import logging
import contextlib
from sonnet.src import initializers
import tensorflow as tf

Expand Down
1 change: 0 additions & 1 deletion sonnet/src/functional/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ snt_py_library(
srcs = ["haiku.py"],
deps = [
":utils",
# pip: contextlib2
# pip: tensorflow
],
)
Expand Down
2 changes: 1 addition & 1 deletion sonnet/src/functional/haiku.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"""Implements part of the Haiku ("Sonnet for JAX") API in TensorFlow 2."""

import collections
import contextlib
import functools
import itertools
import threading

import contextlib
from sonnet.src.functional import utils
import tensorflow as tf

Expand Down
2 changes: 1 addition & 1 deletion sonnet/src/mixed_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
# ============================================================================
"""Mixed Precision Decorator for Sonnet 2."""

import uuid
import contextlib
import uuid

from sonnet.src import custom_getter
from sonnet.src import utils
Expand Down