Skip to content

Commit

Permalink
Merge pull request #253 from gpengzhi/py3
Browse files Browse the repository at this point in the history
Remove __future__ imports
  • Loading branch information
gpengzhi committed Dec 2, 2019
2 parents caa931a + 41c054d commit 44e335e
Show file tree
Hide file tree
Showing 198 changed files with 27 additions and 812 deletions.
27 changes: 27 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
codecov:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "70...100"

status:
project:
default:
threshold: 1%
patch: no
changes: no

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment:
layout: "reach,diff,flags,tree"
behavior: default
require_changes: no
4 changes: 0 additions & 4 deletions examples/bert/bert_classifier_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
"""Example of building a sentence classifier based on pre-trained BERT model.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import importlib
import tensorflow as tf
Expand Down
4 changes: 0 additions & 4 deletions examples/bert/prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
"""Produces TFRecord files and modifies data configuration file
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import tensorflow as tf
import texar.tf as tx
Expand Down
3 changes: 0 additions & 3 deletions examples/distributed_gpu/lm_ptb_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
$ python lm_ptb.py --data_path=simple-examples/data --config=config_small
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name, no-member, too-many-locals

Expand Down
3 changes: 0 additions & 3 deletions examples/distributed_gpu/ptb_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
"""Utilities for preprocessing and iterating over the PTB data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name, too-many-locals

Expand Down
4 changes: 0 additions & 4 deletions examples/gpt-2/gpt2_generate_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
"""Example of building OpenAI GPT-2 language model for sample generation.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import importlib
import numpy as np
import tensorflow as tf
Expand Down
4 changes: 0 additions & 4 deletions examples/gpt-2/gpt2_train_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
"""Example of fine-tuning OpenAI GPT-2 language model.
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import importlib
import tensorflow as tf
Expand Down
4 changes: 0 additions & 4 deletions examples/gpt-2/prepare_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
"""Preprocesses raw data and produces TFRecord files
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import tensorflow as tf
import texar.tf as tx

Expand Down
3 changes: 0 additions & 3 deletions examples/hierarchical_dialog/hred.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"""Hierarchical Recurrent Encoder-Decoder (HRED) for dialog response
generation.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name, too-many-locals

Expand Down
3 changes: 0 additions & 3 deletions examples/language_model_ptb/lm_ptb.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@
$ python lm_ptb.py --data_path=simple-examples/data --config=config_small
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name, no-member, too-many-locals

Expand Down
3 changes: 0 additions & 3 deletions examples/language_model_ptb/ptb_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
"""Utilities for preprocessing and iterating over the PTB data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name, too-many-locals

Expand Down
3 changes: 0 additions & 3 deletions examples/memory_network_lm/lm_ptb_memnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@
This code will automatically save and restore from directory `ckpt/`.
If the directory doesn't exist, it will be created automatically.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name, no-member, too-many-locals

Expand Down
3 changes: 0 additions & 3 deletions examples/memory_network_lm/ptb_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
"""Utilities for preprocessing and iterating over the PTB data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name, too-many-locals

Expand Down
3 changes: 0 additions & 3 deletions examples/rl_gym/ac_cartpole.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"""
Policy gradient for the CartPole game in OpenAI gym.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name

Expand Down
3 changes: 0 additions & 3 deletions examples/rl_gym/dqn_cartpole.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"""
Policy gradient for the CartPole game in OpenAI gym.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name

Expand Down
3 changes: 0 additions & 3 deletions examples/rl_gym/pg_cartpole.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
"""
Policy gradient for the CartPole game in OpenAI gym.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name

Expand Down
3 changes: 0 additions & 3 deletions examples/sentence_classifier/clas_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
$ python clas_main.py --config=config_kim
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import importlib
import tensorflow as tf
Expand Down
3 changes: 0 additions & 3 deletions examples/sentence_classifier/sst_data_preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
"""Preparing the SST2 dataset.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import re
Expand Down
3 changes: 0 additions & 3 deletions examples/seq2seq_attn/seq2seq_attn.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
"""Attentional Seq2seq.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division

# pylint: disable=invalid-name, too-many-arguments, too-many-locals

Expand Down
4 changes: 0 additions & 4 deletions examples/seq2seq_exposure_bias/baseline_seq2seq_attn_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@
Attentional Seq2seq.
same as examples/seq2seq_attn except that here Rouge is also supported.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

# pylint: disable=invalid-name, too-many-arguments, too-many-locals

Expand Down
3 changes: 0 additions & 3 deletions examples/seq2seq_exposure_bias/interpolation_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
which stores one more variable in 'state' recording the
decoded ids(state: [decoded_ids, rnn_state]).
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=no-name-in-module, too-many-arguments, too-many-locals
# pylint: disable=not-context-manager, protected-access, invalid-name
Expand Down
3 changes: 0 additions & 3 deletions examples/seq2seq_exposure_bias/interpolation_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@
Helper for interpolation algirithm.
New token is sample from model, ground_truth or reward according to lambdas
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import tensorflow as tf
import numpy as np
Expand Down
4 changes: 0 additions & 4 deletions examples/seq2seq_exposure_bias/interpolation_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@

"""Interpolation Algorithm.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

import importlib
from io import open
Expand Down
4 changes: 0 additions & 4 deletions examples/seq2seq_exposure_bias/raml_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
RAML Algorithm is described in https://arxiv.org/pdf/1705.07136.pdf
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

from io import open
import importlib
Expand Down
4 changes: 0 additions & 4 deletions examples/seq2seq_exposure_bias/scheduled_sampling_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@
Scheduled Sampling Algorithm is described in https://arxiv.org/abs/1506.03099
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals

# pylint: disable=invalid-name, too-many-arguments, too-many-locals

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
from nltk.translate.bleu_score import sentence_bleu
from nltk.translate.bleu_score import SmoothingFunction
import sys
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from __future__ import print_function
import argparse
from collections import Counter
from itertools import chain
Expand Down
3 changes: 0 additions & 3 deletions examples/seq2seq_rl/seq2seq_attn_pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
"""Attentional Seq2seq trained with policy gradient.
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division

# pylint: disable=invalid-name, too-many-arguments, too-many-locals

Expand Down
3 changes: 0 additions & 3 deletions examples/seqgan/seqgan_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
"""SeqGAN for language modeling
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name, no-member, too-many-locals

Expand Down
3 changes: 0 additions & 3 deletions examples/sequence_tagging/conll_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
"""Utilities for preprocessing and iterating over the CoNLL 2003 data.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import re
from collections import defaultdict
Expand Down
3 changes: 0 additions & 3 deletions examples/sequence_tagging/ner.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
"""Sequence tagging.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os
import time
Expand Down
3 changes: 0 additions & 3 deletions examples/text_style_transfer/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
"""Config
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name

Expand Down
3 changes: 0 additions & 3 deletions examples/text_style_transfer/ctrl_gen_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
# limitations under the License.
"""Text style transfer
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name, too-many-locals

Expand Down
3 changes: 0 additions & 3 deletions examples/text_style_transfer/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
$ python main.py --config config
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

# pylint: disable=invalid-name, too-many-locals, too-many-arguments, no-member

Expand Down
4 changes: 0 additions & 4 deletions examples/torchtext/lm_torchtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
""" Language Modeling example using torchtext
"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import time
import importlib
import numpy as np
Expand Down
5 changes: 0 additions & 5 deletions examples/transformer/bleu_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@
# BLEU score will be similar to the one obtained using: mteval-v14.pl
# Note:compound splitting is not implemented in this module

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

from argparse import ArgumentParser
from io import open
import collections
Expand Down
4 changes: 0 additions & 4 deletions examples/transformer/transformer_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
# limitations under the License.
"""Transformer model.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals

import pickle
import random
Expand Down
1 change: 0 additions & 1 deletion examples/transformer/utils/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
preprocessing text data. Generally it's to generate plain text vocab file,
truncate sequence by length, generate the preprocessed dataset.
"""
from __future__ import unicode_literals
import collections
import re
import json
Expand Down

0 comments on commit 44e335e

Please sign in to comment.