Skip to content

Commit 27c7158

Browse files
bugrafacebook-github-bot
authored andcommitted
Remove __future__ imports for legacy Python2 supports (pytorch#45033)
Summary: There is a module called `2to3` which you can target for future specifically to remove these, the directory of `caffe2` has the most redundant imports: ```2to3 -f future -w caffe2``` Pull Request resolved: pytorch#45033 Reviewed By: seemethere Differential Revision: D23808648 Pulled By: bugra fbshipit-source-id: 38971900f0fe43ab44a9168e57f2307580d36a38
1 parent e9aa689 commit 27c7158

File tree

597 files changed

+2086
-2086
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

597 files changed

+2086
-2086
lines changed

caffe2/contrib/aten/aten_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
from caffe2.python import core, dyndep
77
from hypothesis import given

caffe2/contrib/fakelowp/test/test_batchmatmul_nnpi_fp16.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import numpy as np
77
import unittest

caffe2/contrib/fakelowp/test/test_batchnorm_nnpi_fp16.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import numpy as np
77
import unittest

caffe2/contrib/fakelowp/test/test_deq_swish_quant_nnpi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import absolute_import, division, print_function, unicode_literals
1+
22

33
import numpy as np
44
import caffe2.python.fakelowp.init_shared_libs # noqa

caffe2/contrib/fakelowp/test/test_fc_nnpi_fp16.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import numpy as np
77
import unittest

caffe2/contrib/fakelowp/test/test_fusions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import absolute_import, division, print_function, unicode_literals
1+
22

33
# Must happen before importing caffe2.python.*
44
import caffe2.python.fakelowp.init_shared_libs # noqa

caffe2/contrib/fakelowp/test/test_int8_ops_nnpi.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import absolute_import, division, print_function, unicode_literals
1+
22

33
import caffe2.python.fakelowp.init_shared_libs # noqa
44
import numpy as np

caffe2/contrib/fakelowp/test/test_int8_quant.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import absolute_import, division, print_function, unicode_literals
1+
22

33
# Must happen before importing caffe2.python.*
44
import caffe2.python.fakelowp.init_shared_libs # noqa

caffe2/contrib/fakelowp/test/test_layernorm_nnpi_fp16.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import numpy as np
77
import caffe2.python.fakelowp.init_shared_libs # noqa

caffe2/contrib/fakelowp/test/test_op_nnpi_fp16.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import numpy as np
77

caffe2/contrib/fakelowp/test/test_sls_4bit_nnpi_fp16.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import numpy as np
77
import unittest

caffe2/contrib/fakelowp/test/test_sls_8bit_nnpi_fp16.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import absolute_import, division, print_function, unicode_literals
1+
22

33
import unittest
44

caffe2/contrib/fakelowp/test/test_sls_8bit_nnpi_fp32.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import absolute_import, division, print_function, unicode_literals
1+
22

33
import unittest
44

caffe2/contrib/gloo/gloo_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#!/usr/bin/env python
22

3-
from __future__ import absolute_import
4-
from __future__ import division
5-
from __future__ import print_function
6-
from __future__ import unicode_literals
3+
4+
5+
6+
77

88
from hypothesis import given, settings
99
import hypothesis.strategies as st

caffe2/contrib/nccl/nccl_ops_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import unittest
77
import hypothesis.strategies as st

caffe2/contrib/nnpack/nnpack_ops_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import unittest
77
import hypothesis.strategies as st

caffe2/contrib/playground/AnyExp.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
from abc import abstractmethod
77

caffe2/contrib/playground/AnyExpOnTerm.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import argparse
77
import json

caffe2/contrib/playground/ModuleRegister.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import inspect
77
import logging

caffe2/contrib/playground/checkpoint.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import numpy as np
77
import pickle

caffe2/contrib/playground/compute_loss.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import caffe2.contrib.playground.meter as Meter
77
from caffe2.python import workspace

caffe2/contrib/playground/compute_topk_accuracy.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import caffe2.contrib.playground.meter as Meter
77
from caffe2.python import workspace

caffe2/contrib/playground/meter.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
from abc import abstractmethod
77

caffe2/contrib/playground/module_map.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
# Input
77
import caffe2.contrib.playground.resnetdemo.\

caffe2/contrib/playground/output_generator.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
from caffe2.python import timeout_guard
77

caffe2/contrib/playground/resnetdemo/IN1k_resnet.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import numpy as np
77

caffe2/contrib/playground/resnetdemo/IN1k_resnet_no_test_model.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import numpy as np
77

caffe2/contrib/playground/resnetdemo/caffe2_resnet50_default_forward.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import caffe2.python.models.resnet as resnet
77

caffe2/contrib/playground/resnetdemo/caffe2_resnet50_default_param_update.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66

77
def gen_param_update_builder_fun(self, model, dataset, is_train):

caffe2/contrib/playground/resnetdemo/explicit_resnet_forward.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import logging
77
logging.basicConfig()

caffe2/contrib/playground/resnetdemo/explicit_resnet_param_update.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
from caffe2.python import workspace, core
77
from caffe2.proto import caffe2_pb2

caffe2/contrib/playground/resnetdemo/gfs_IN1k.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
# # example1 using gfs as input source.
77

caffe2/contrib/playground/resnetdemo/override_no_test_model_no_checkpoint.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
def checkpoint(self, epoch):
77
self.model_path = None

caffe2/contrib/playground/resnetdemo/rendezvous_filestore.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
from caffe2.python import core, workspace
77
from caffe2.python import dyndep

caffe2/contrib/prof/cuda_profile_ops_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import unittest
77
from caffe2.proto import caffe2_pb2

caffe2/contrib/tensorboard/tensorboard.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from __future__ import absolute_import
2-
from __future__ import division
3-
from __future__ import print_function
4-
from __future__ import unicode_literals
1+
2+
3+
4+
55

66
import click
77
import collections

0 commit comments

Comments
 (0)