epignatelli / helx

Interoperating between (Deep) Reiforcement Learning libraries
Apache License 2.0
10 stars 6 forks source link

55/A2C + 56/brax #57

Closed epignatelli closed 10 months ago

github-actions[bot] commented 1 year ago
************* Module a2c_brax_ant
examples/a2c_brax_ant.py:1:0: C0114: Missing module docstring (missing-module-docstring)
examples/a2c_brax_ant.py:28:0: C0116: Missing function or method docstring (missing-function-docstring)
************* Module helx
helx/__init__.py:1:0: C0114: Missing module docstring (missing-module-docstring)
************* Module helx.agents.a2c
helx/agents/a2c.py:78:0: C0301: Line too long (108/100) (line-too-long)
helx/agents/a2c.py:80:0: C0301: Line too long (103/100) (line-too-long)
helx/agents/a2c.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/agents/a2c.py:41:0: C0115: Missing class docstring (missing-class-docstring)
helx/agents/a2c.py:41:0: R0903: Too few public methods (1/2) (too-few-public-methods)
helx/agents/a2c.py:62:4: R0913: Too many arguments (6/5) (too-many-arguments)
helx/agents/a2c.py:102:4: W0221: Number of parameters was 4 in 'Agent.loss' and is now 4 in overriding 'A2C.loss' method (arguments-differ)
helx/agents/a2c.py:102:4: W0221: Variadics removed in overriding 'A2C.loss' method (arguments-differ)
helx/agents/a2c.py:102:4: R0914: Too many local variables (21/15) (too-many-locals)
************* Module helx.agents.agent
helx/agents/agent.py:134:0: C0301: Line too long (106/100) (line-too-long)
helx/agents/agent.py:42:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/agents/agent.py:49:0: R0902: Too many instance attributes (9/7) (too-many-instance-attributes)
helx/agents/agent.py:133:46: W0622: Redefining built-in 'eval' (redefined-builtin)
helx/agents/agent.py:133:46: W0613: Unused argument 'eval' (unused-argument)
helx/agents/agent.py:145:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/agents/agent.py:150:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/agents/agent.py:189:23: C0103: Argument name "n" doesn't conform to snake_case naming style (invalid-name)
************* Module helx.agents.dqn
helx/agents/dqn.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/agents/dqn.py:37:0: C0115: Missing class docstring (missing-class-docstring)
helx/agents/dqn.py:37:0: R0903: Too few public methods (1/2) (too-few-public-methods)
helx/agents/dqn.py:89:4: W0221: Number of parameters was 4 in 'Agent.loss' and is now 4 in overriding 'DQN.loss' method (arguments-differ)
helx/agents/dqn.py:89:4: W0221: Variadics removed in overriding 'DQN.loss' method (arguments-differ)
helx/agents/dqn.py:95:28: C0103: Variable name "d" doesn't conform to snake_case naming style (invalid-name)
************* Module helx.agents.random
helx/agents/random.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/agents/random.py:35:4: W0231: __init__ method from base class 'Agent' is not called (super-init-not-called)
helx/agents/random.py:44:4: W0237: Parameter 'env' has been renamed to 'observation' in overriding 'Random.sample_action' method (arguments-renamed)
helx/agents/random.py:44:48: W0622: Redefining built-in 'eval' (redefined-builtin)
helx/agents/random.py:44:28: W0613: Unused argument 'observation' (unused-argument)
helx/agents/random.py:47:4: W0221: Number of parameters was 4 in 'Agent.loss' and is now 4 in overriding 'Random.loss' method (arguments-differ)
helx/agents/random.py:47:4: W0221: Variadics removed in overriding 'Random.loss' method (arguments-differ)
helx/agents/random.py:51:8: W0613: Unused argument 'params_target' (unused-argument)
************* Module helx.agents.sac
helx/agents/sac.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/agents/sac.py:44:0: C0115: Missing class docstring (missing-class-docstring)
helx/agents/sac.py:44:0: R0903: Too few public methods (1/2) (too-few-public-methods)
helx/agents/sac.py:86:4: R0913: Too many arguments (6/5) (too-many-arguments)
helx/agents/sac.py:112:4: W0221: Number of parameters was 4 in 'Agent.loss' and is now 5 in overriding 'SAC.loss' method (arguments-differ)
helx/agents/sac.py:112:4: W0221: Variadics removed in overriding 'SAC.loss' method (arguments-differ)
helx/agents/sac.py:112:4: R0914: Too many local variables (29/15) (too-many-locals)
helx/agents/sac.py:119:26: C0103: Variable name "d" doesn't conform to snake_case naming style (invalid-name)
helx/agents/sac.py:128:8: C0103: Variable name "qA_0" doesn't conform to snake_case naming style (invalid-name)
helx/agents/sac.py:128:14: C0103: Variable name "qB_0" doesn't conform to snake_case naming style (invalid-name)
helx/agents/sac.py:129:8: C0103: Variable name "qA_1" doesn't conform to snake_case naming style (invalid-name)
helx/agents/sac.py:129:14: C0103: Variable name "qB_1" doesn't conform to snake_case naming style (invalid-name)
helx/agents/sac.py:28:0: W0611: Unused import wandb (unused-import)
************* Module helx.agents.sacd
helx/agents/sacd.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/agents/sacd.py:45:0: C0115: Missing class docstring (missing-class-docstring)
helx/agents/sacd.py:45:0: R0903: Too few public methods (1/2) (too-few-public-methods)
helx/agents/sacd.py:62:4: R0913: Too many arguments (6/5) (too-many-arguments)
helx/agents/sacd.py:87:4: W0221: Number of parameters was 4 in 'Agent.loss' and is now 5 in overriding 'SACD.loss' method (arguments-differ)
helx/agents/sacd.py:87:4: W0221: Variadics removed in overriding 'SACD.loss' method (arguments-differ)
helx/agents/sacd.py:87:4: R0914: Too many local variables (31/15) (too-many-locals)
helx/agents/sacd.py:94:26: C0103: Variable name "d" doesn't conform to snake_case naming style (invalid-name)
helx/agents/sacd.py:95:23: C3001: Lambda expression assigned to a variable. Define a function using the "def" keyword instead. (unnecessary-lambda-assignment)
helx/agents/sacd.py:104:8: C0103: Variable name "qA_0" doesn't conform to snake_case naming style (invalid-name)
helx/agents/sacd.py:104:14: C0103: Variable name "qB_0" doesn't conform to snake_case naming style (invalid-name)
helx/agents/sacd.py:105:8: C0103: Variable name "qA_1" doesn't conform to snake_case naming style (invalid-name)
helx/agents/sacd.py:105:14: C0103: Variable name "qB_1" doesn't conform to snake_case naming style (invalid-name)
helx/agents/sacd.py:28:0: W0611: Unused import wandb (unused-import)
************* Module helx.download
helx/download.py:91:0: C0301: Line too long (110/100) (line-too-long)
helx/download.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/download.py:38:4: C0103: Variable name "r" doesn't conform to snake_case naming style (invalid-name)
helx/download.py:38:8: W3101: Missing timeout argument for method 'requests.get' can cause your program to hang indefinitely (missing-timeout)
helx/download.py:39:4: W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
helx/download.py:40:33: C0103: Variable name "fd" doesn't conform to snake_case naming style (invalid-name)
helx/download.py:47:0: C0116: Missing function or method docstring (missing-function-docstring)
helx/download.py:79:4: W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
helx/download.py:90:0: C0116: Missing function or method docstring (missing-function-docstring)
helx/download.py:126:4: W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
helx/download.py:132:0: C0116: Missing function or method docstring (missing-function-docstring)
helx/download.py:143:4: W1203: Use lazy % formatting in logging functions (logging-fstring-interpolation)
helx/download.py:150:11: W0718: Catching too general exception Exception (broad-exception-caught)
helx/download.py:150:4: C0103: Variable name "e" doesn't conform to snake_case naming style (invalid-name)
helx/download.py:157:0: C0116: Missing function or method docstring (missing-function-docstring)
************* Module helx.environment
helx/environment/__init__.py:1:0: C0114: Missing module docstring (missing-module-docstring)
************* Module helx.environment.base
helx/environment/base.py:34:0: C0115: Missing class docstring (missing-class-docstring)
helx/environment/base.py:34:0: R0902: Too many instance attributes (8/7) (too-many-instance-attributes)
helx/environment/base.py:46:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:50:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:54:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:58:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:62:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:66:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:70:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:74:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:78:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:82:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:85:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/base.py:94:4: E0302: The special method '__exit__' expects 3 param(s), 0 was given (unexpected-special-method-signature)
************* Module helx.environment.brax
helx/environment/brax.py:88:9: W0511: TODO: Handle mode (fixme)
helx/environment/brax.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/brax.py:35:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/brax.py:40:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/brax.py:45:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/brax.py:51:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/brax.py:53:19: W0212: Access to a protected member _get_observation of a client class (protected-access)
helx/environment/brax.py:61:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/brax.py:72:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/brax.py:82:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/brax.py:82:4: R1711: Useless return at end of function or method (useless-return)
helx/environment/brax.py:87:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/brax.py:87:21: W0613: Unused argument 'mode' (unused-argument)
helx/environment/brax.py:92:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/brax.py:36:11: E0203: Access to member '_action_space' before its definition line 37 (access-member-before-definition)
helx/environment/brax.py:41:11: E0203: Access to member '_observation_space' before its definition line 42 (access-member-before-definition)
helx/environment/brax.py:46:11: E0203: Access to member '_reward_space' before its definition line 47 (access-member-before-definition)
helx/environment/brax.py:37:12: W0201: Attribute '_action_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/brax.py:42:12: W0201: Attribute '_observation_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/brax.py:47:12: W0201: Attribute '_reward_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/brax.py:69:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/brax.py:79:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/brax.py:83:8: W0201: Attribute '_seed' defined outside __init__ (attribute-defined-outside-init)
helx/environment/brax.py:84:8: W0201: Attribute '_key' defined outside __init__ (attribute-defined-outside-init)
************* Module helx.environment.bsuite
helx/environment/bsuite.py:39:9: W0511: TODO (epignatelli): Remove this once dm_env is correctly typed. (fixme)
helx/environment/bsuite.py:47:9: W0511: TODO (epignatelli): Remove this once dm_env is correctly typed. (fixme)
helx/environment/bsuite.py:59:9: W0511: TODO (epignatelli): Remove this once bsuite is updated. (fixme)
helx/environment/bsuite.py:87:9: W0511: TODO: Handle mode (fixme)
helx/environment/bsuite.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/bsuite.py:32:4: W0246: Useless parent or super() delegation in method '__init__' (useless-parent-delegation)
helx/environment/bsuite.py:35:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/bsuite.py:43:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/bsuite.py:51:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/bsuite.py:58:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/bsuite.py:61:19: W0212: Access to a protected member _get_observation of a client class (protected-access)
helx/environment/bsuite.py:69:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/bsuite.py:69:20: W0613: Unused argument 'seed' (unused-argument)
helx/environment/bsuite.py:74:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/bsuite.py:81:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/bsuite.py:81:4: R1711: Useless return at end of function or method (useless-return)
helx/environment/bsuite.py:86:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/bsuite.py:86:21: W0613: Unused argument 'mode' (unused-argument)
helx/environment/bsuite.py:91:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/bsuite.py:36:11: E0203: Access to member '_action_space' before its definition line 40 (access-member-before-definition)
helx/environment/bsuite.py:37:19: E0203: Access to member '_action_space' before its definition line 40 (access-member-before-definition)
helx/environment/bsuite.py:44:11: E0203: Access to member '_observation_space' before its definition line 48 (access-member-before-definition)
helx/environment/bsuite.py:45:19: E0203: Access to member '_observation_space' before its definition line 48 (access-member-before-definition)
helx/environment/bsuite.py:52:11: E0203: Access to member '_reward_space' before its definition line 55 (access-member-before-definition)
helx/environment/bsuite.py:53:19: E0203: Access to member '_reward_space' before its definition line 55 (access-member-before-definition)
helx/environment/bsuite.py:40:8: W0201: Attribute '_action_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/bsuite.py:48:8: W0201: Attribute '_observation_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/bsuite.py:55:8: W0201: Attribute '_reward_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/bsuite.py:71:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/bsuite.py:78:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/bsuite.py:82:8: W0201: Attribute '_seed' defined outside __init__ (attribute-defined-outside-init)
helx/environment/bsuite.py:83:8: W0201: Attribute '_key' defined outside __init__ (attribute-defined-outside-init)
************* Module helx.environment.distributed
helx/environment/distributed.py:84:0: C0301: Line too long (111/100) (line-too-long)
helx/environment/distributed.py:85:0: C0301: Line too long (107/100) (line-too-long)
helx/environment/distributed.py:98:0: C0301: Line too long (102/100) (line-too-long)
helx/environment/distributed.py:222:0: C0304: Final newline missing (missing-final-newline)
helx/environment/distributed.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/distributed.py:40:19: C0103: Argument name "a" doesn't conform to snake_case naming style (invalid-name)
helx/environment/distributed.py:46:25: C0103: Argument name "a" doesn't conform to snake_case naming style (invalid-name)
helx/environment/distributed.py:46:4: R1711: Useless return at end of function or method (useless-return)
helx/environment/distributed.py:73:42: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/environment/distributed.py:89:4: W0231: __init__ method from base class 'Environment' is not called (super-init-not-called)
helx/environment/distributed.py:98:11: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/environment/distributed.py:114:28: R1704: Redefining argument with the local name 'env' (redefined-argument-from-local)
helx/environment/distributed.py:124:15: C0103: Variable name "p" doesn't conform to snake_case naming style (invalid-name)
helx/environment/distributed.py:125:25: W1202: Use lazy % formatting in logging functions (logging-format-interpolation)
helx/environment/distributed.py:125:25: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/environment/distributed.py:143:4: W0221: Number of parameters was 2 in 'Environment.reset' and is now 1 in overriding 'MultiprocessEnv.reset' method (arguments-differ)
helx/environment/distributed.py:148:4: W0237: Parameter 'action' has been renamed to 'actions' in overriding 'MultiprocessEnv.step' method (arguments-renamed)
helx/environment/distributed.py:150:12: C0103: Variable name "a" doesn't conform to snake_case naming style (invalid-name)
helx/environment/distributed.py:154:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/distributed.py:156:12: C0103: Variable name "a" doesn't conform to snake_case naming style (invalid-name)
helx/environment/distributed.py:154:4: R1711: Useless return at end of function or method (useless-return)
helx/environment/distributed.py:163:12: C0103: Variable name "p" doesn't conform to snake_case naming style (invalid-name)
helx/environment/distributed.py:172:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/distributed.py:181:11: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/environment/distributed.py:205:4: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
helx/environment/distributed.py:206:15: E0110: Abstract class 'MultiprocessEnv' with abstract methods instantiated (abstract-class-instantiated)
************* Module helx.environment.dm_control
helx/environment/dm_control.py:24:9: W0511: TODO (epignatelli): Implement this (fixme)
helx/environment/dm_control.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/dm_control.py:23:4: W0231: __init__ method from base class 'Environment' is not called (super-init-not-called)
************* Module helx.environment.dm_env
helx/environment/dm_env.py:38:9: W0511: TODO (epignatelli): remove type ignore once dm_env is correctly typed. (fixme)
helx/environment/dm_env.py:46:9: W0511: TODO (epignatelli): remove type ignore once dm_env is correctly typed. (fixme)
helx/environment/dm_env.py:54:9: W0511: TODO (epignatelli): remove type ignore once dm_env is correctly typed. (fixme)
helx/environment/dm_env.py:81:9: W0511: TODO: Handle mode (fixme)
helx/environment/dm_env.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/dm_env.py:31:4: W0246: Useless parent or super() delegation in method '__init__' (useless-parent-delegation)
helx/environment/dm_env.py:34:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/dm_env.py:42:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/dm_env.py:50:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/dm_env.py:58:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/dm_env.py:65:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/dm_env.py:65:20: W0613: Unused argument 'seed' (unused-argument)
helx/environment/dm_env.py:70:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/dm_env.py:75:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/dm_env.py:75:4: R1711: Useless return at end of function or method (useless-return)
helx/environment/dm_env.py:80:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/dm_env.py:80:21: W0613: Unused argument 'mode' (unused-argument)
helx/environment/dm_env.py:85:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/dm_env.py:35:11: E0203: Access to member '_action_space' before its definition line 39 (access-member-before-definition)
helx/environment/dm_env.py:36:19: E0203: Access to member '_action_space' before its definition line 39 (access-member-before-definition)
helx/environment/dm_env.py:43:11: E0203: Access to member '_observation_space' before its definition line 47 (access-member-before-definition)
helx/environment/dm_env.py:44:19: E0203: Access to member '_observation_space' before its definition line 47 (access-member-before-definition)
helx/environment/dm_env.py:51:11: E0203: Access to member '_reward_space' before its definition line 55 (access-member-before-definition)
helx/environment/dm_env.py:52:19: E0203: Access to member '_reward_space' before its definition line 55 (access-member-before-definition)
helx/environment/dm_env.py:39:8: W0201: Attribute '_action_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/dm_env.py:47:8: W0201: Attribute '_observation_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/dm_env.py:55:8: W0201: Attribute '_reward_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/dm_env.py:67:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/dm_env.py:72:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/dm_env.py:76:8: W0201: Attribute '_seed' defined outside __init__ (attribute-defined-outside-init)
helx/environment/dm_env.py:77:8: W0201: Attribute '_key' defined outside __init__ (attribute-defined-outside-init)
************* Module helx.environment.gym
helx/environment/gym.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/gym.py:57:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:64:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:71:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:80:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:87:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:97:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:103:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:108:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:112:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:115:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:58:11: E0203: Access to member '_action_space' before its definition line 61 (access-member-before-definition)
helx/environment/gym.py:59:19: E0203: Access to member '_action_space' before its definition line 61 (access-member-before-definition)
helx/environment/gym.py:65:11: E0203: Access to member '_observation_space' before its definition line 68 (access-member-before-definition)
helx/environment/gym.py:66:19: E0203: Access to member '_observation_space' before its definition line 68 (access-member-before-definition)
helx/environment/gym.py:72:11: E0203: Access to member '_reward_space' before its definition line 77 (access-member-before-definition)
helx/environment/gym.py:73:19: E0203: Access to member '_reward_space' before its definition line 77 (access-member-before-definition)
helx/environment/gym.py:61:8: W0201: Attribute '_action_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym.py:68:8: W0201: Attribute '_observation_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym.py:77:8: W0201: Attribute '_reward_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym.py:94:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym.py:100:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym.py:105:8: W0201: Attribute '_seed' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym.py:106:8: W0201: Attribute '_key' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym.py:119:0: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym.py:30:0: C0412: Imports from package gym are not grouped (ungrouped-imports)
************* Module helx.environment.gym3
helx/environment/gym3.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/gym3.py:37:4: W0246: Useless parent or super() delegation in method '__init__' (useless-parent-delegation)
helx/environment/gym3.py:40:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym3.py:47:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym3.py:54:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym3.py:63:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym3.py:70:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym3.py:70:20: W0613: Unused argument 'seed' (unused-argument)
helx/environment/gym3.py:77:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym3.py:84:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym3.py:87:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym3.py:90:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym3.py:93:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gym3.py:41:11: E0203: Access to member '_action_space' before its definition line 44 (access-member-before-definition)
helx/environment/gym3.py:42:19: E0203: Access to member '_action_space' before its definition line 44 (access-member-before-definition)
helx/environment/gym3.py:48:11: E0203: Access to member '_observation_space' before its definition line 51 (access-member-before-definition)
helx/environment/gym3.py:49:19: E0203: Access to member '_observation_space' before its definition line 51 (access-member-before-definition)
helx/environment/gym3.py:55:11: E0203: Access to member '_reward_space' before its definition line 60 (access-member-before-definition)
helx/environment/gym3.py:56:19: E0203: Access to member '_reward_space' before its definition line 60 (access-member-before-definition)
helx/environment/gym3.py:44:8: W0201: Attribute '_action_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym3.py:51:8: W0201: Attribute '_observation_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym3.py:60:8: W0201: Attribute '_reward_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym3.py:74:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym3.py:81:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gym3.py:18:0: W0611: Unused cast imported from typing (unused-import)
************* Module helx.environment.gymnasium
helx/environment/gymnasium.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/gymnasium.py:36:4: W0246: Useless parent or super() delegation in method '__init__' (useless-parent-delegation)
helx/environment/gymnasium.py:39:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gymnasium.py:46:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gymnasium.py:53:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gymnasium.py:62:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gymnasium.py:69:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gymnasium.py:70:13: W0612: Unused variable 'info' (unused-variable)
helx/environment/gymnasium.py:74:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gymnasium.py:80:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gymnasium.py:85:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gymnasium.py:89:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gymnasium.py:92:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/environment/gymnasium.py:40:11: E0203: Access to member '_action_space' before its definition line 43 (access-member-before-definition)
helx/environment/gymnasium.py:41:19: E0203: Access to member '_action_space' before its definition line 43 (access-member-before-definition)
helx/environment/gymnasium.py:47:11: E0203: Access to member '_observation_space' before its definition line 50 (access-member-before-definition)
helx/environment/gymnasium.py:48:19: E0203: Access to member '_observation_space' before its definition line 50 (access-member-before-definition)
helx/environment/gymnasium.py:54:11: E0203: Access to member '_reward_space' before its definition line 59 (access-member-before-definition)
helx/environment/gymnasium.py:55:19: E0203: Access to member '_reward_space' before its definition line 59 (access-member-before-definition)
helx/environment/gymnasium.py:43:8: W0201: Attribute '_action_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gymnasium.py:50:8: W0201: Attribute '_observation_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gymnasium.py:59:8: W0201: Attribute '_reward_space' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gymnasium.py:71:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gymnasium.py:77:8: W0201: Attribute '_current_observation' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gymnasium.py:82:8: W0201: Attribute '_seed' defined outside __init__ (attribute-defined-outside-init)
helx/environment/gymnasium.py:83:8: W0201: Attribute '_key' defined outside __init__ (attribute-defined-outside-init)
************* Module helx.environment.gymnax
helx/environment/gymnax.py:24:9: W0511: TODO (epignatelli): Implement this (fixme)
helx/environment/gymnax.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/gymnax.py:23:4: W0231: __init__ method from base class 'Environment' is not called (super-init-not-called)
************* Module helx.environment.interop
helx/environment/interop.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/interop.py:44:0: C0116: Missing function or method docstring (missing-function-docstring)
************* Module helx.environment.ivy_gym
helx/environment/ivy_gym.py:24:9: W0511: TODO (epignatelli): Implement this (fixme)
helx/environment/ivy_gym.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/environment/ivy_gym.py:23:4: W0231: __init__ method from base class 'Environment' is not called (super-init-not-called)
************* Module helx.experiment
helx/experiment.py:176:0: C0304: Final newline missing (missing-final-newline)
helx/experiment.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/experiment.py:25:36: W0622: Redefining built-in 'eval' (redefined-builtin)
helx/experiment.py:45:4: C0103: Variable name "t" doesn't conform to snake_case naming style (invalid-name)
helx/experiment.py:49:8: C0103: Variable name "t" doesn't conform to snake_case naming style (invalid-name)
helx/experiment.py:56:0: C0116: Missing function or method docstring (missing-function-docstring)
helx/experiment.py:56:0: R0913: Too many arguments (6/5) (too-many-arguments)
helx/experiment.py:65:8: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/experiment.py:70:8: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/experiment.py:102:23: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/experiment.py:113:16: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
************* Module helx.logging
helx/logging.py:156:0: C0301: Line too long (102/100) (line-too-long)
helx/logging.py:171:0: C0301: Line too long (102/100) (line-too-long)
helx/logging.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/logging.py:49:0: C0103: Constant name "_logger" doesn't conform to UPPER_CASE naming style (invalid-name)
helx/logging.py:52:0: C0116: Missing function or method docstring (missing-function-docstring)
helx/logging.py:53:4: W0603: Using the global statement (global-statement)
helx/logging.py:58:8: C0103: Variable name "ch" doesn't conform to snake_case naming style (invalid-name)
helx/logging.py:64:0: C0115: Missing class docstring (missing-class-docstring)
helx/logging.py:75:8: W0622: Redefining built-in 'format' (redefined-builtin)
helx/logging.py:84:0: C0115: Missing class docstring (missing-class-docstring)
helx/logging.py:97:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/logging.py:100:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/logging.py:103:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/logging.py:106:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/logging.py:109:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/logging.py:112:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/logging.py:115:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/logging.py:118:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/logging.py:118:4: R1711: Useless return at end of function or method (useless-return)
helx/logging.py:122:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/logging.py:122:4: R1711: Useless return at end of function or method (useless-return)
helx/logging.py:130:0: C0115: Missing class docstring (missing-class-docstring)
helx/logging.py:131:4: W0231: __init__ method from base class 'Logger' is not called (super-init-not-called)
helx/logging.py:143:0: C0115: Missing class docstring (missing-class-docstring)
helx/logging.py:151:0: C0115: Missing class docstring (missing-class-docstring)
helx/logging.py:159:23: R1734: Consider using [] instead of list() (use-list-literal)
helx/logging.py:166:0: C0115: Missing class docstring (missing-class-docstring)
helx/logging.py:174:23: R1734: Consider using [] instead of list() (use-list-literal)
helx/logging.py:181:0: C0115: Missing class docstring (missing-class-docstring)
helx/logging.py:203:0: C0115: Missing class docstring (missing-class-docstring)
************* Module helx.mdp
helx/mdp.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/mdp.py:35:0: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:39:0: C0115: Missing class docstring (missing-class-docstring)
helx/mdp.py:52:0: C0115: Missing class docstring (missing-class-docstring)
helx/mdp.py:58:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:61:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:64:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:68:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:81:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:94:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:125:23: C0103: Argument name "s" doesn't conform to snake_case naming style (invalid-name)
helx/mdp.py:125:39: C0103: Argument name "a" doesn't conform to snake_case naming style (invalid-name)
helx/mdp.py:125:55: C0103: Argument name "r" doesn't conform to snake_case naming style (invalid-name)
helx/mdp.py:125:71: C0103: Argument name "d" doesn't conform to snake_case naming style (invalid-name)
helx/mdp.py:132:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:132:4: C0103: Attribute name "s" doesn't conform to snake_case naming style (invalid-name)
helx/mdp.py:136:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:136:4: C0103: Attribute name "a" doesn't conform to snake_case naming style (invalid-name)
helx/mdp.py:140:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:140:4: C0103: Attribute name "r" doesn't conform to snake_case naming style (invalid-name)
helx/mdp.py:144:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:144:4: C0103: Attribute name "d" doesn't conform to snake_case naming style (invalid-name)
helx/mdp.py:148:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:152:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:156:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:160:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:164:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:181:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:187:8: W0613: Unused argument 'aux' (unused-argument)
helx/mdp.py:194:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:197:4: R1711: Useless return at end of function or method (useless-return)
helx/mdp.py:230:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/mdp.py:19:0: W0611: Unused partial imported from functools (unused-import)
************* Module helx.memory
helx/memory.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/memory.py:78:21: C0103: Argument name "n" doesn't conform to snake_case naming style (invalid-name)
helx/memory.py:18:0: W0611: Unused List imported from typing (unused-import)
************* Module helx.networks
helx/networks/__init__.py:1:0: C0114: Missing module docstring (missing-module-docstring)
************* Module helx.networks.actors
helx/networks/actors.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/networks/actors.py:35:0: C0115: Missing class docstring (missing-class-docstring)
helx/networks/actors.py:35:0: R0903: Too few public methods (1/2) (too-few-public-methods)
helx/networks/actors.py:44:0: C0115: Missing class docstring (missing-class-docstring)
helx/networks/actors.py:52:8: W0622: Redefining built-in 'eval' (redefined-builtin)
helx/networks/actors.py:53:8: C0103: Variable name "x" doesn't conform to snake_case naming style (invalid-name)
helx/networks/actors.py:44:0: R0903: Too few public methods (1/2) (too-few-public-methods)
helx/networks/actors.py:69:0: C0115: Missing class docstring (missing-class-docstring)
helx/networks/actors.py:75:8: C0103: Variable name "mu" doesn't conform to snake_case naming style (invalid-name)
helx/networks/actors.py:69:0: R0903: Too few public methods (1/2) (too-few-public-methods)
helx/networks/actors.py:92:0: C0115: Missing class docstring (missing-class-docstring)
helx/networks/actors.py:92:0: R0903: Too few public methods (1/2) (too-few-public-methods)
************* Module helx.networks.critics
helx/networks/critics.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/networks/critics.py:26:0: R0903: Too few public methods (1/2) (too-few-public-methods)
helx/networks/critics.py:40:0: R0903: Too few public methods (1/2) (too-few-public-methods)
helx/networks/critics.py:76:8: C0103: Variable name "q1" doesn't conform to snake_case naming style (invalid-name)
helx/networks/critics.py:77:8: C0103: Variable name "q2" doesn't conform to snake_case naming style (invalid-name)
helx/networks/critics.py:59:0: R0903: Too few public methods (1/2) (too-few-public-methods)
************* Module helx.spaces
helx/spaces.py:140:0: C0301: Line too long (117/100) (line-too-long)
helx/spaces.py:1:0: C0114: Missing module docstring (missing-module-docstring)
helx/spaces.py:33:0: C0115: Missing class docstring (missing-class-docstring)
helx/spaces.py:35:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/spaces.py:34:4: W4905: Using deprecated decorator abc.abstractproperty() (deprecated-decorator)
helx/spaces.py:39:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/spaces.py:38:4: W4905: Using deprecated decorator abc.abstractproperty() (deprecated-decorator)
helx/spaces.py:43:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/spaces.py:42:4: W4905: Using deprecated decorator abc.abstractproperty() (deprecated-decorator)
helx/spaces.py:47:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/spaces.py:51:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/spaces.py:52:8: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
helx/spaces.py:58:16: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/spaces.py:62:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/spaces.py:63:8: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
helx/spaces.py:69:16: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/spaces.py:75:4: C0116: Missing function or method docstring (missing-function-docstring)
helx/spaces.py:76:8: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
helx/spaces.py:82:16: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/spaces.py:86:0: C0115: Missing class docstring (missing-class-docstring)
helx/spaces.py:104:15: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/spaces.py:125:0: C0115: Missing class docstring (missing-class-docstring)
helx/spaces.py:140:11: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/spaces.py:157:15: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/spaces.py:165:8: R1705: Unnecessary "elif" after "return", remove the leading "el" from "elif" (no-else-return)
helx/spaces.py:181:16: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
helx/spaces.py:208:0: C0116: Missing function or method docstring (missing-function-docstring)
************* Module test_atari
test/test_atari.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test/test_atari.py:35:0: C0116: Missing function or method docstring (missing-function-docstring)
test/test_atari.py:37:21: W1202: Use lazy % formatting in logging functions (logging-format-interpolation)
test/test_atari.py:37:21: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
test/test_atari.py:50:26: W1202: Use lazy % formatting in logging functions (logging-format-interpolation)
test/test_atari.py:50:26: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
************* Module test_bsuite
test/test_bsuite.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test/test_bsuite.py:28:0: C0116: Missing function or method docstring (missing-function-docstring)
test/test_bsuite.py:30:21: W1202: Use lazy % formatting in logging functions (logging-format-interpolation)
test/test_bsuite.py:30:21: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
************* Module test_flags
test/test_flags.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test/test_flags.py:28:0: C0116: Missing function or method docstring (missing-function-docstring)
************* Module test_gym3_procgen
test/test_gym3_procgen.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test/test_gym3_procgen.py:31:0: C0116: Missing function or method docstring (missing-function-docstring)
test/test_gym3_procgen.py:33:21: W1202: Use lazy % formatting in logging functions (logging-format-interpolation)
test/test_gym3_procgen.py:33:21: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
************* Module test_gym_minigrid
test/test_gym_minigrid.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test/test_gym_minigrid.py:28:0: C0116: Missing function or method docstring (missing-function-docstring)
test/test_gym_minigrid.py:30:21: W1202: Use lazy % formatting in logging functions (logging-format-interpolation)
test/test_gym_minigrid.py:30:21: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
************* Module test_gym_mujoco
test/test_gym_mujoco.py:1:0: C0114: Missing module docstring (missing-module-docstring)
test/test_gym_mujoco.py:28:0: C0116: Missing function or method docstring (missing-function-docstring)
test/test_gym_mujoco.py:30:21: W1202: Use lazy % formatting in logging functions (logging-format-interpolation)
test/test_gym_mujoco.py:30:21: C0209: Formatting a regular string which could be a f-string (consider-using-f-string)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.agents.sac:[151:203]
==helx.agents.sacd:[133:185]
        loss = actor_loss + critic_loss + temperature_loss
        aux = (actor_loss, critic_loss, temperature_loss, policy_entropy, alpha)
        return loss, aux

    def update(self, episode: Trajectory) -> Dict[str, Any]:
        # update iteration
        self.iteration += 1
        log = {}
        log.update({"Iteration": self.iteration})

        # update memory
        transitions: List[Transition] = episode.transitions()
        self.memory.add_range(transitions)
        log.update({"Buffer size": len(self.memory)})

        # if replay buffer is smaller than the minimum size, there is nothing else to do
        if len(self.memory) < self.hparams.replay_start:
            return log

        # check update period
        if self.iteration % self.hparams.update_frequency != 0:
            return log

        episode_batch: Transition = self.memory.sample(self.hparams.batch_size)
        params, opt_state, loss, aux = self.sgd_step(
            self.params,
            episode_batch,
            self.opt_state,
            self._new_key(),
            self.params_target,
        )

        # update dqn state
        self.opt_state = opt_state
        self.params = params
        self.params_target = jax.tree_map(
            lambda theta, theta_: theta * self.hparams.tau
            + (1 - self.hparams.tau) * theta_,
            self.params,
            self.params_target,
        )

        aux = jax.tree_map(jnp.mean, aux)  # reduce aux
        actor_loss, critic_loss, temperature_loss, policy_entropy, alpha = aux
        log.update({"train/total_loss": loss})
        log.update({"train/actor_loss": actor_loss})
        log.update({"train/critic_loss": critic_loss})
        log.update({"train/temperature_loss": temperature_loss})
        log.update({"train/policy_entropy": policy_entropy})
        log.update({"train/alpha": alpha})
        log.update({"train/Return": jnp.sum(episode.r)})
        return log (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.gym3:[37:72]
==helx.environment.gym:[54:87]
        super().__init__(env)

    def action_space(self) -> Space:
        if self._action_space is not None:
            return self._action_space

        self._action_space = Space.from_gym(self._env.action_space)
        return self._action_space

    def observation_space(self) -> Space:
        if self._observation_space is not None:
            return self._observation_space

        self._observation_space = Space.from_gym(self._env.observation_space)
        return self._observation_space

    def reward_space(self) -> Space:
        if self._reward_space is not None:
            return self._reward_space

        minimum = self._env.reward_range[0]
        maximum = self._env.reward_range[1]
        self._reward_space = Continuous((1,), (minimum,), (maximum,))
        return self._reward_space

    def state(self) -> Array:
        if self._current_observation is None:
            raise ValueError(
                "Environment not initialized. Run `reset` first, to set a starting state."
            )
        return self._current_observation

    def reset(self, seed: int | None = None) -> Timestep:
        # TODO(epignatelli): remove try/except when gym3 is updated.
        # see: https://github.com/openai/gym3/issues/8 (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.bsuite:[32:59]
==helx.environment.dm_env:[31:58]
        super().__init__(env)

    def action_space(self) -> Space:
        if self._action_space is not None:
            return self._action_space

        # TODO (epignatelli): Remove this once dm_env is correctly typed.
        self._action_space = Space.from_dm_env(self._env.action_spec())  # type: ignore
        return self._action_space

    def observation_space(self) -> Space:
        if self._observation_space is not None:
            return self._observation_space

        # TODO (epignatelli): Remove this once dm_env is correctly typed.
        self._observation_space = Space.from_dm_env(self._env.observation_spec())  # type: ignore
        return self._observation_space

    def reward_space(self) -> Space:
        if self._reward_space is not None:
            return self._reward_space

        self._reward_space = Space.from_dm_env(self._env.reward_spec())
        return self._reward_space

    def state(self) -> Array:
        # TODO (epignatelli): Remove this once bsuite is updated. (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.gym:[68:87]
==helx.environment.gymnasium:[50:69]
        return self._observation_space

    def reward_space(self) -> Space:
        if self._reward_space is not None:
            return self._reward_space

        minimum = self._env.reward_range[0]
        maximum = self._env.reward_range[1]
        self._reward_space = Continuous((1,), (minimum,), (maximum,))
        return self._reward_space

    def state(self) -> Array:
        if self._current_observation is None:
            raise ValueError(
                "Environment not initialized. Run `reset` first, to set a starting state."
            )
        return self._current_observation

    def reset(self, seed: int | None = None) -> Timestep: (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.bsuite:[76:92]
==helx.environment.dm_env:[70:86]
        next_step = self._env.step(action.item())
        self._current_observation = jnp.asarray(next_step[0])
        return Timestep.from_dm_env(next_step)

    def seed(self, seed: int) -> None:
        self._seed = seed
        self._key = jax.random.PRNGKey(self._seed)
        return

    def render(self, mode: str = "human"):
        # TODO: Handle mode
        current_state = self.state()
        return current_state

    def close(self) -> None:
        return self._env.close() (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==test_gym_minigrid:[24:38]
==test_gym_mujoco:[24:37]
logging = helx.logging.get_default_logger()

def test_gym_minigrid():
    def test_env(env_id):
        logging.info("Testing env: {}".format(env_id))
        env = gym.make(env_id)
        env = helx.environment.to_helx(env)
        env.reset()
        key = jax.random.PRNGKey(i)
        env.step(env.action_space().sample(key))
        env.close()

    # get all minigrid envs (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.bsuite:[62:75]
==helx.environment.dm_env:[58:70]
        if self._current_observation is None:
            raise ValueError(
                "Environment not initialized. Run `reset` first to produce a starting state."
            )
        return self._current_observation

    def reset(self, seed: int | None = None) -> Timestep:
        next_step = self._env.reset()
        self._current_observation = jnp.asarray(next_step[0])
        return Timestep.from_dm_env(next_step)

    def step(self, action: Action) -> Timestep:
        # bsuite only has discrete actions envs (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.brax:[48:61]
==helx.environment.bsuite:[55:69]
        return self._reward_space

    def state(self) -> Array:
        # TODO (epignatelli): Remove this once bsuite is updated.
        if hasattr(self._env, "_get_observation"):
            return self._env._get_observation()  # type: ignore

        if self._current_observation is None:
            raise ValueError(
                "Environment not initialized. Run `reset` first to produce a starting state."
            )
        return self._current_observation

    def reset(self, seed: int | None = None) -> Timestep: (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.agents.sac:[100:109]
==helx.agents.sacd:[76:93]
                representation_net_a=deep_copy(critic_representation_net),
                representation_net_b=deep_copy(critic_representation_net),
            ),
            extra_net=Temperature(),
        )

        super().__init__(hparams, network, optimiser, seed)
        self.memory = Buffer(hparams.replay_memory_size)
        self.params_target: nn.FrozenDict = self.params.copy({}) (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==test_atari:[36:45]
==test_gym3_procgen:[32:40]
        logging.info("Testing env: {}".format(env_id))
        env = gym.make(env_id)
        env = helx.environment.to_helx(env)
        env.reset()
        key = jax.random.PRNGKey(i)
        env.step(env.action_space().sample(key))
        env.close()
 (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.agents.a2c:[139:148]
==helx.agents.sac:[172:180]
            return log

        # if it is, perform a learning step
        episode_batch: Transition = self.memory.sample(self.hparams.batch_size)
        params, opt_state, loss, aux = self.sgd_step(
            self.params,
            episode_batch,
            self.opt_state,
            self._new_key(), (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.gym:[104:119]
==helx.environment.gymnasium:[81:93]
        self._seed = seed
        self._key = jax.random.PRNGKey(seed)

    def render(self, mode: str = "human"):
        self._env.render_mode = mode
        return self._env.render()

    def close(self) -> None:
        return self._env.close()

    def name(self) -> str:
        return self._env.unwrapped.__class__.__name__

def list_envs(namespace: str) -> List[str]: (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.base:[46:70]
==helx.logging:[97:115]
        raise NotImplementedError()

    @abc.abstractmethod
    def observation_space(self) -> Space:
        raise NotImplementedError()

    @abc.abstractmethod
    def reward_space(self) -> Space:
        raise NotImplementedError()

    @abc.abstractmethod
    def state(self) -> Array:
        raise NotImplementedError()

    @abc.abstractmethod
    def reset(self, seed: int | None = None) -> Timestep:
        raise NotImplementedError()

    @abc.abstractmethod
    def step(self, action: Action) -> Timestep:
        raise NotImplementedError()

    @abc.abstractmethod
    def seed(self, seed: int) -> None: (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.agents.dqn:[116:128]
==helx.agents.sac:[164:175]
        log.update({"Buffer size": len(self.memory)})

        # if replay buffer is smaller than the minimum size, there is nothing else to do
        if len(self.memory) < self.hparams.replay_start:
            return log

        # update every `update_frequency` steps
        if self.iteration % self.hparams.update_frequency != 0:
            return log

        # update dqn state
        episode_batch: Transition = self.memory.sample(self.hparams.batch_size) (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.agents.dqn:[43:50]
==helx.agents.sac:[48:54]
    replay_start: int = 1000
    replay_memory_size: int = 1000
    update_frequency: int = 1
    target_network_update_frequency: int = 10000
    discount: float = 0.99
    n_steps: int = 1
    # sgd (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==test_atari:[38:45]
==test_bsuite:[31:38]
        env = helx.environment.to_helx(env)
        env.reset()
        key = jax.random.PRNGKey(i)
        env.step(env.action_space().sample(key))
        env.close()

    # get all bsuite envs (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.gym:[93:100]
==helx.environment.gymnasium:[70:77]
        self._current_observation = jnp.asarray(obs)
        return Timestep(obs, None, StepType.TRANSITION)

    def step(self, action: Action) -> Timestep:
        action_ = np.asarray(action)
        next_step = self._env.step(action_)
        self._current_observation = jnp.asarray(next_step[0]) (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.brax:[82:92]
==helx.environment.bsuite:[81:91]
        self._seed = seed
        self._key = jax.random.PRNGKey(self._seed)
        return

    def render(self, mode: str = "human"):
        # TODO: Handle mode
        current_state = self.state()
        return current_state

    def close(self) -> None: (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.base:[62:82]
==helx.logging:[97:112]
        raise NotImplementedError()

    @abc.abstractmethod
    def step(self, action: Action) -> Timestep:
        raise NotImplementedError()

    @abc.abstractmethod
    def seed(self, seed: int) -> None:
        raise NotImplementedError()

    @abc.abstractmethod
    def render(self, mode: str = "human"):
        raise NotImplementedError()

    @abc.abstractmethod
    def close(self) -> None:
        raise NotImplementedError()

    # @abc.abstractmethod
    def n_parallel(self) -> int: (duplicate-code)
test/test_gym_mujoco.py:1:0: R0801: Similar lines in 2 files
==helx.environment.base:[46:66]
==helx.logging:[100:115]
        raise NotImplementedError()

    def record_video(self, name: str, video: Array, step: int):
        raise NotImplementedError()

    def record_audio(self, name: str, audio: Array, step: int):
        raise NotImplementedError()

    def record_histogram(self, name: str, histogram: Array, step: int):
        raise NotImplementedError()

    def record_graph(self, name: str, graph: Any, step: int):
        raise NotImplementedError()

    def log(self, message: str, level: int = logging.INFO): (duplicate-code)

Report
======
1649 statements analysed.

Statistics by type
------------------

+---------+-------+-----------+-----------+------------+---------+
|type     |number |old number |difference |%documented |%badname |
+=========+=======+===========+===========+============+=========+
|module   |37     |NC         |NC         |8.11        |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|class    |44     |NC         |NC         |50.00       |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|method   |213    |NC         |NC         |49.77       |0.00     |
+---------+-------+-----------+-----------+------------+---------+
|function |29     |NC         |NC         |41.38       |0.00     |
+---------+-------+-----------+-----------+------------+---------+

3747 lines have been analyzed

Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |2129   |56.82 |NC       |NC         |
+----------+-------+------+---------+-----------+
|docstring |303    |8.09  |NC       |NC         |
+----------+-------+------+---------+-----------+
|comment   |664    |17.72 |NC       |NC         |
+----------+-------+------+---------+-----------+
|empty     |651    |17.37 |NC       |NC         |
+----------+-------+------+---------+-----------+

Duplication
-----------

+-------------------------+------+---------+-----------+
|                         |now   |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines      |0     |NC       |NC         |
+-------------------------+------+---------+-----------+
|percent duplicated lines |0.000 |NC       |NC         |
+-------------------------+------+---------+-----------+

Messages by category
--------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |253    |NC       |NC         |
+-----------+-------+---------+-----------+
|refactor   |56     |NC       |NC         |
+-----------+-------+---------+-----------+
|warning    |115    |NC       |NC         |
+-----------+-------+---------+-----------+
|error      |35     |NC       |NC         |
+-----------+-------+---------+-----------+

Messages
--------

+------------------------------------+------------+
|message id                          |occurrences |
+====================================+============+
|missing-function-docstring          |124         |
+------------------------------------+------------+
|attribute-defined-outside-init      |40          |
+------------------------------------+------------+
|invalid-name                        |38          |
+------------------------------------+------------+
|missing-module-docstring            |34          |
+------------------------------------+------------+
|access-member-before-definition     |33          |
+------------------------------------+------------+
|missing-class-docstring             |22          |
+------------------------------------+------------+
|consider-using-f-string             |21          |
+------------------------------------+------------+
|duplicate-code                      |20          |
+------------------------------------+------------+
|fixme                               |12          |
+------------------------------------+------------+
|too-few-public-methods              |11          |
+------------------------------------+------------+
|arguments-differ                    |11          |
+------------------------------------+------------+
|unused-argument                     |10          |
+------------------------------------+------------+
|line-too-long                       |10          |
+------------------------------------+------------+
|useless-return                      |8           |
+------------------------------------+------------+
|logging-format-interpolation        |7           |
+------------------------------------+------------+
|super-init-not-called               |6           |
+------------------------------------+------------+
|unused-import                       |5           |
+------------------------------------+------------+
|redefined-builtin                   |5           |
+------------------------------------+------------+
|no-else-return                      |5           |
+------------------------------------+------------+
|useless-parent-delegation           |4           |
+------------------------------------+------------+
|too-many-arguments                  |4           |
+------------------------------------+------------+
|logging-fstring-interpolation       |4           |
+------------------------------------+------------+
|too-many-locals                     |3           |
+------------------------------------+------------+
|deprecated-decorator                |3           |
+------------------------------------+------------+
|use-list-literal                    |2           |
+------------------------------------+------------+
|too-many-instance-attributes        |2           |
+------------------------------------+------------+
|protected-access                    |2           |
+------------------------------------+------------+
|missing-final-newline               |2           |
+------------------------------------+------------+
|arguments-renamed                   |2           |
+------------------------------------+------------+
|unused-variable                     |1           |
+------------------------------------+------------+
|unnecessary-lambda-assignment       |1           |
+------------------------------------+------------+
|ungrouped-imports                   |1           |
+------------------------------------+------------+
|unexpected-special-method-signature |1           |
+------------------------------------+------------+
|redefined-argument-from-local       |1           |
+------------------------------------+------------+
|missing-timeout                     |1           |
+------------------------------------+------------+
|global-statement                    |1           |
+------------------------------------+------------+
|broad-exception-caught              |1           |
+------------------------------------+------------+
|abstract-class-instantiated         |1           |
+------------------------------------+------------+

-----------------------------------
Your code has been rated at 6.37/10
epignatelli commented 1 year ago

Note. At bd8247e351d446fa0887698fc49d3ed9c9edac9b checks are passing locally.