Skip to content

Commit 52f09e6

Browse files
oprypincopybara-github
authored andcommitted
Replace obsolete import contextlib2 with the equivalent stdlib module contextlib
PiperOrigin-RevId: 767547534
1 parent c99b491 commit 52f09e6

File tree

7 files changed

+4
-8
lines changed

7 files changed

+4
-8
lines changed

sonnet/src/BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ snt_py_library(
195195
srcs = ["custom_getter.py"],
196196
deps = [
197197
":base",
198-
# pip: contextlib2
199198
# pip: tensorflow
200199
# pip: tree
201200
],
@@ -637,7 +636,6 @@ snt_py_library(
637636
deps = [
638637
":custom_getter",
639638
":utils",
640-
# pip: contextlib2
641639
# pip: tensorflow
642640
# pip: tree
643641
],

sonnet/src/custom_getter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
# ============================================================================
1515
"""Custom getter for module members."""
1616

17+
import contextlib
1718
from typing import Any, Callable, ContextManager, Iterable, Optional, Type
1819

19-
import contextlib
2020
from sonnet.src import base
2121
import tensorflow as tf
2222
import tree

sonnet/src/distribute/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ snt_py_library(
3535
srcs = ["replicator.py"],
3636
deps = [
3737
# pip: absl/logging
38-
# pip: contextlib2
3938
"//sonnet/src:initializers",
4039
# pip: tensorflow
4140
],

sonnet/src/distribute/replicator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
# ============================================================================
1515
"""Replicator Distribution Strategy."""
1616

17+
import contextlib
1718
from typing import Callable, TypeVar
1819

1920
from absl import logging
20-
import contextlib
2121
from sonnet.src import initializers
2222
import tensorflow as tf
2323

sonnet/src/functional/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ snt_py_library(
99
srcs = ["haiku.py"],
1010
deps = [
1111
":utils",
12-
# pip: contextlib2
1312
# pip: tensorflow
1413
],
1514
)

sonnet/src/functional/haiku.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
"""Implements part of the Haiku ("Sonnet for JAX") API in TensorFlow 2."""
1616

1717
import collections
18+
import contextlib
1819
import functools
1920
import itertools
2021
import threading
2122

22-
import contextlib
2323
from sonnet.src.functional import utils
2424
import tensorflow as tf
2525

sonnet/src/mixed_precision.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
# ============================================================================
1515
"""Mixed Precision Decorator for Sonnet 2."""
1616

17-
import uuid
1817
import contextlib
18+
import uuid
1919

2020
from sonnet.src import custom_getter
2121
from sonnet.src import utils

0 commit comments

Comments
 (0)