kengz/SLM-Lab

View on GitHub

Showing 104 of 104 total issues

Comparison to false should be 'if cond is false:' or 'if not cond:'
Open

        if self.spec['meta'].get('distributed') == False:
Severity: Minor
Found in slm_lab/experiment/control.py by pep8

Comparison to singletons should use "is" or "is not".

Comparisons to singletons like None should always be done
with "is" or "is not", never the equality operators.

Okay: if arg is not None:
E711: if arg != None:
E711: if None == arg:
E712: if arg == True:
E712: if False == arg:

Also, beware of writing if x when you really mean if x is not None --
e.g. when testing whether a variable or argument that defaults to None was
set to some other value.  The other value might have a type (such as a
container) that could be false in a boolean context!

Module level import not at top of file
Open

from slm_lab.spec import spec_util
Severity: Minor
Found in run_lab.py by pep8

Place imports at the top of the file.

Always put imports at the top of the file, just after any module comments
and docstrings, and before module globals and constants.

Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimport os
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
E402: a=1\nimport os
E402: 'One string'\n"Two string"\nimport os
E402: a=1\nfrom sys import x

Okay: if x:\n    import os

Module level import not at top of file
Open

import torch.multiprocessing as mp
Severity: Minor
Found in run_lab.py by pep8

Place imports at the top of the file.

Always put imports at the top of the file, just after any module comments
and docstrings, and before module globals and constants.

Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimport os
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
E402: a=1\nimport os
E402: 'One string'\n"Two string"\nimport os
E402: a=1\nfrom sys import x

Okay: if x:\n    import os

Comparison to false should be 'if cond is false:' or 'if not cond:'
Open

        assert ps.get(spec, 'agent.0.net.gpu') == False, f'Distributed mode "synced" works with CPU only. Set gpu: false.'
Severity: Minor
Found in slm_lab/spec/spec_util.py by pep8

Comparison to singletons should use "is" or "is not".

Comparisons to singletons like None should always be done
with "is" or "is not", never the equality operators.

Okay: if arg is not None:
E711: if arg != None:
E711: if None == arg:
E712: if arg == True:
E712: if False == arg:

Also, beware of writing if x when you really mean if x is not None --
e.g. when testing whether a variable or argument that defaults to None was
set to some other value.  The other value might have a type (such as a
container) that could be false in a boolean context!

Module level import not at top of file
Open

from slm_lab.experiment.control import Session, Trial, Experiment
Severity: Minor
Found in run_lab.py by pep8

Place imports at the top of the file.

Always put imports at the top of the file, just after any module comments
and docstrings, and before module globals and constants.

Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimport os
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
E402: a=1\nimport os
E402: 'One string'\n"Two string"\nimport os
E402: a=1\nfrom sys import x

Okay: if x:\n    import os

Module level import not at top of file
Open

from slm_lab.experiment import search
Severity: Minor
Found in run_lab.py by pep8

Place imports at the top of the file.

Always put imports at the top of the file, just after any module comments
and docstrings, and before module globals and constants.

Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimport os
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
E402: a=1\nimport os
E402: 'One string'\n"Two string"\nimport os
E402: a=1\nfrom sys import x

Okay: if x:\n    import os

Module level import not at top of file
Open

import torch
Severity: Minor
Found in run_lab.py by pep8

Place imports at the top of the file.

Always put imports at the top of the file, just after any module comments
and docstrings, and before module globals and constants.

Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimport os
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
E402: a=1\nimport os
E402: 'One string'\n"Two string"\nimport os
E402: a=1\nfrom sys import x

Okay: if x:\n    import os

Ambiguous variable name 'l'
Open

        margin=go.layout.Margin(l=60, r=30, t=60, b=60),
Severity: Minor
Found in slm_lab/lib/viz.py by pep8

Never use the characters 'l', 'O', or 'I' as variable names.

In some fonts, these characters are indistinguishable from the numerals
one and zero. When tempted to use 'l', use 'L' instead.

Okay: L = 0
Okay: o = 123
Okay: i = 42
E741: l = 0
E741: O = 123
E741: I = 42

Variables can be bound in several other contexts, including class and
function definitions, 'global' and 'nonlocal' statements, exception
handlers, and 'with' statements.

Okay: except AttributeError as o:
Okay: with lock as L:
E741: except AttributeError as O:
E741: with lock as l:
E741: global I
E741: nonlocal l
E742: class I(object):
E743: def l(x):

Module level import not at top of file
Open

import sys
Severity: Minor
Found in run_lab.py by pep8

Place imports at the top of the file.

Always put imports at the top of the file, just after any module comments
and docstrings, and before module globals and constants.

Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimport os
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
E402: a=1\nimport os
E402: 'One string'\n"Two string"\nimport os
E402: a=1\nfrom sys import x

Okay: if x:\n    import os

Expected 1 blank line before a nested definition, found 0
Open

    def get_name(s): return s.split('-')[0]
Severity: Minor
Found in slm_lab/spec/random_baseline.py by pep8

Separate top-level function and class definitions with two blank lines.

Method definitions inside a class are separated by a single blank line.

Extra blank lines may be used (sparingly) to separate groups of related
functions.  Blank lines may be omitted between a bunch of related
one-liners (e.g. a set of dummy implementations).

Use blank lines in functions, sparingly, to indicate logical sections.

Okay: def a():\n    pass\n\n\ndef b():\n    pass
Okay: def a():\n    pass\n\n\nasync def b():\n    pass
Okay: def a():\n    pass\n\n\n# Foo\n# Bar\n\ndef b():\n    pass
Okay: default = 1\nfoo = 1
Okay: classify = 1\nfoo = 1

E301: class Foo:\n    b = 0\n    def bar():\n        pass
E302: def a():\n    pass\n\ndef b(n):\n    pass
E302: def a():\n    pass\n\nasync def b(n):\n    pass
E303: def a():\n    pass\n\n\n\ndef b(n):\n    pass
E303: def a():\n\n\n\n    pass
E304: @decorator\n\ndef a():\n    pass
E305: def a():\n    pass\na()
E306: def a():\n    def b():\n        pass\n    def c():\n        pass

Module level import not at top of file
Open

from slm_lab.lib import logger, util
Severity: Minor
Found in run_lab.py by pep8

Place imports at the top of the file.

Always put imports at the top of the file, just after any module comments
and docstrings, and before module globals and constants.

Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimport os
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
E402: a=1\nimport os
E402: 'One string'\n"Two string"\nimport os
E402: a=1\nfrom sys import x

Okay: if x:\n    import os

Module level import not at top of file
Open

import pydash as ps
Severity: Minor
Found in run_lab.py by pep8

Place imports at the top of the file.

Always put imports at the top of the file, just after any module comments
and docstrings, and before module globals and constants.

Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimport os
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
E402: a=1\nimport os
E402: 'One string'\n"Two string"\nimport os
E402: a=1\nfrom sys import x

Okay: if x:\n    import os

Module level import not at top of file
Open

from slm_lab import EVAL_MODES, TRAIN_MODES
Severity: Minor
Found in run_lab.py by pep8

Place imports at the top of the file.

Always put imports at the top of the file, just after any module comments
and docstrings, and before module globals and constants.

Okay: import os
Okay: # this is a comment\nimport os
Okay: '''this is a module docstring'''\nimport os
Okay: r'''this is a module docstring'''\nimport os
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nelse:\n\tpass\nimport y
Okay:
try:\n\timport x\nexcept ImportError:\n\tpass\nfinally:\n\tpass\nimport y
E402: a=1\nimport os
E402: 'One string'\n"Two string"\nimport os
E402: a=1\nfrom sys import x

Okay: if x:\n    import os

Comparison to false should be 'if cond is not false:' or 'if cond:'
Open

        if spec['meta']['distributed'] != False:  # divide max_frame for distributed
Severity: Minor
Found in slm_lab/env/base.py by pep8

Comparison to singletons should use "is" or "is not".

Comparisons to singletons like None should always be done
with "is" or "is not", never the equality operators.

Okay: if arg is not None:
E711: if arg != None:
E711: if None == arg:
E712: if arg == True:
E712: if False == arg:

Also, beware of writing if x when you really mean if x is not None --
e.g. when testing whether a variable or argument that defaults to None was
set to some other value.  The other value might have a type (such as a
container) that could be false in a boolean context!

TODO found
Open

        # TODO In future, need to update action to handle (continuous) DELTA buttons using gym's Box space
Severity: Minor
Found in slm_lab/env/vizdoom/vizdoom_env.py by fixme

TODO found
Open

# TODO rework

TODO found
Open

            # TODO support multi-discrete actions
Severity: Minor
Found in slm_lab/agent/algorithm/sac.py by fixme

TODO found
Open

    # TODO generalize for unity too once it has a gym wrapper
Severity: Minor
Found in slm_lab/spec/random_baseline.py by fixme

TODO found
Open

        # TODO use the same loss_fn but do not reduce yet
Severity: Minor
Found in slm_lab/agent/algorithm/dqn.py by fixme

TODO found
Open

    # TODO expand to be more comprehensive
Severity: Minor
Found in slm_lab/spec/spec_util.py by fixme
Severity
Category
Status
Source
Language