diff --git a/ci/travis/format.sh b/ci/travis/format.sh index 7b04cbb3d..d1860976b 100755 --- a/ci/travis/format.sh +++ b/ci/travis/format.sh @@ -99,6 +99,8 @@ YAPF_EXCLUDES=( '--exclude' 'python/ray/thirdparty_files/*' ) +FLAKE8_EXCLUDES="python/ray/core/generated/,streaming/python/generated,doc/source/conf.py,python/ray/cloudpickle/,python/ray/thirdparty_files/" + shellcheck_scripts() { shellcheck "${SHELLCHECK_FLAGS[@]}" "$@" } @@ -176,14 +178,17 @@ format_changed() { yapf --in-place "${YAPF_EXCLUDES[@]}" "${YAPF_FLAGS[@]}" if which flake8 >/dev/null; then git diff --name-only --diff-filter=ACRM "$MERGEBASE" -- '*.py' | xargs -P 5 \ - flake8 --inline-quotes '"' --no-avoid-escape --exclude=python/ray/core/generated/,streaming/python/generated,doc/source/conf.py,python/ray/cloudpickle/,python/ray/thirdparty_files/ --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605,F821 + flake8 --inline-quotes '"' --no-avoid-escape --exclude="$FLAKE8_EXCLUDES,rllib/" --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605 + # Ignore F821 for rllib flake8 checking (produces errors for type annotations using quotes (non-imported classes)). + git diff --name-only --diff-filter=ACRM "$MERGEBASE" -- '*.py' | xargs -P 5 \ + flake8 --inline-quotes '"' --no-avoid-escape --exclude="$FLAKE8_EXCLUDES" --filename="rllib/" --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605,F821 fi fi if ! git diff --diff-filter=ACRM --quiet --exit-code "$MERGEBASE" -- '*.pyx' '*.pxd' '*.pxi' &>/dev/null; then if which flake8 >/dev/null; then git diff --name-only --diff-filter=ACRM "$MERGEBASE" -- '*.pyx' '*.pxd' '*.pxi' | xargs -P 5 \ - flake8 --inline-quotes '"' --no-avoid-escape --exclude=python/ray/core/generated/,streaming/python/generated,doc/source/conf.py,python/ray/cloudpickle/,python/ray/thirdparty_files/ --ignore=C408,E121,E123,E126,E211,E225,E226,E227,E24,E704,E999,W503,W504,W605 + flake8 --inline-quotes '"' --no-avoid-escape --exclude="$FLAKE8_EXCLUDES" --ignore=C408,E121,E123,E126,E211,E225,E226,E227,E24,E704,E999,W503,W504,W605 fi fi @@ -213,7 +218,9 @@ format_changed() { # Format all files, and print the diff to stdout for travis. format_all() { - flake8 --inline-quotes '"' --no-avoid-escape --exclude=python/ray/core/generated/,streaming/python/generated,doc/source/conf.py,python/ray/cloudpickle/,python/ray/thirdparty_files/ --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605 + # Ignore F821 for rllib flake8 checking (produces errors for type annotations using quotes (non-imported classes)). + flake8 --inline-quotes '"' --no-avoid-escape --exclude="$FLAKE8_EXCLUDES,rllib/" --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605 + flake8 --inline-quotes '"' --no-avoid-escape --exclude="$FLAKE8_EXCLUDES" --filename="rllib/" --ignore=C408,E121,E123,E126,E226,E24,E704,W503,W504,W605,F821 yapf --diff "${YAPF_FLAGS[@]}" "${YAPF_EXCLUDES[@]}" test python diff --git a/rllib/BUILD b/rllib/BUILD index 140abcb42..b91a903b3 100644 --- a/rllib/BUILD +++ b/rllib/BUILD @@ -1459,7 +1459,7 @@ py_test( name = "examples/batch_norm_model_ddpg_tf", main = "examples/batch_norm_model.py", tags = ["examples", "examples_B"], - size = "small", + size = "medium", srcs = ["examples/batch_norm_model.py"], args = ["--run=DDPG", "--stop-iters=1"] ) @@ -1468,7 +1468,7 @@ py_test( name = "examples/batch_norm_model_ddpg_torch", main = "examples/batch_norm_model.py", tags = ["examples", "examples_B"], - size = "small", + size = "medium", srcs = ["examples/batch_norm_model.py"], args = ["--torch", "--run=DDPG", "--stop-iters=1"] ) diff --git a/rllib/agents/a3c/a2c.py b/rllib/agents/a3c/a2c.py index 0ac16e8ad..0a71a359c 100644 --- a/rllib/agents/a3c/a2c.py +++ b/rllib/agents/a3c/a2c.py @@ -4,10 +4,10 @@ from ray.rllib.agents.a3c.a3c import DEFAULT_CONFIG as A3C_CONFIG, \ validate_config, get_policy_class from ray.rllib.agents.a3c.a3c_tf_policy import A3CTFPolicy from ray.rllib.agents.trainer_template import build_trainer +from ray.rllib.execution.metric_ops import StandardMetricsReporting from ray.rllib.execution.rollout_ops import ParallelRollouts, ConcatBatches from ray.rllib.execution.train_ops import ComputeGradients, AverageGradients, \ ApplyGradients, TrainOneStep -from ray.rllib.execution.metric_ops import StandardMetricsReporting from ray.rllib.utils import merge_dicts A2C_DEFAULT_CONFIG = merge_dicts(