浏览代码

fix errors from new flake8-comprehensions (#2917)

/develop-newnormalization
GitHub 5 年前
当前提交
99981937
共有 7 个文件被更改,包括 15 次插入19 次删除
  1. 8
      .pre-commit-config.yaml
  2. 5
      gym-unity/gym_unity/envs/__init__.py
  3. 10
      ml-agents-envs/mlagents/envs/environment.py
  4. 1
      ml-agents/mlagents/trainers/barracuda.py
  5. 4
      ml-agents/mlagents/trainers/ppo/models.py
  6. 5
      ml-agents/mlagents/trainers/sac/models.py
  7. 1
      ml-agents/mlagents/trainers/tensorflow_to_barracuda.py

8
.pre-commit-config.yaml


)$
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.720
rev: v0.740
hooks:
- id: mypy
name: mypy-ml-agents

args: [--ignore-missing-imports, --disallow-incomplete-defs]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.2.3
rev: v2.4.0
hooks:
- id: mixed-line-ending
exclude: >

args: [--assume-in-merge]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.4.1 # Use the ref you want to point at
rev: v1.4.2
hooks:
- id: python-check-mock-methods

rev: v2.4.3
rev: v2.4.4
hooks:
- id: pylint
exclude: >

5
gym-unity/gym_unity/envs/__init__.py


self._n_agents = None
self._multiagent = multiagent
self._flattener = None
self.game_over = (
False
) # Hidden flag used by Atari environments to determine if the game is over
# Hidden flag used by Atari environments to determine if the game is over
self.game_over = False
self._allow_multiple_visual_obs = allow_multiple_visual_obs
# Check brain configuration

10
ml-agents-envs/mlagents/envs/environment.py


self.port = base_port + worker_id
self._buffer_size = 12000
self._version_ = UnityEnvironment.API_VERSION
self._loaded = (
False
) # If true, this means the environment was successfully loaded
self.proc1 = (
None
) # The process that is started. If None, no process was started
# If true, this means the environment was successfully loaded
self._loaded = False
# The process that is started. If None, no process was started
self.proc1 = None
self.timeout_wait: int = timeout_wait
self.communicator = self.get_communicator(worker_id, base_port, timeout_wait)
self.worker_id = worker_id

1
ml-agents/mlagents/trainers/barracuda.py


# pylint: skip-file
# flake8: noqa
from __future__ import print_function
from collections import defaultdict
import numpy as np

4
ml-agents/mlagents/trainers/ppo/models.py


)
)
self.all_log_probs = tf.concat(
[branch for branch in policy_branches], axis=1, name="action_probs"
)
self.all_log_probs = tf.concat(policy_branches, axis=1, name="action_probs")
self.action_masks = tf.placeholder(
shape=[None, sum(self.act_size)], dtype=tf.float32, name="action_masks"

5
ml-agents/mlagents/trainers/sac/models.py


kernel_initializer=tf.initializers.variance_scaling(0.01),
)
)
all_logits = tf.concat(
[branch for branch in policy_branches], axis=1, name="action_probs"
)
all_logits = tf.concat(policy_branches, axis=1, name="action_probs")
output, normalized_probs, normalized_logprobs = self.create_discrete_action_masking_layer(
all_logits, self.action_masks, self.act_size
)

1
ml-agents/mlagents/trainers/tensorflow_to_barracuda.py


# pylint: skip-file
# flake8: noqa
from __future__ import print_function
import numpy as np
import struct # convert from Python values and C structs

正在加载...
取消
保存