kengz/SLM-Lab

View on GitHub

Showing 95 of 95 total issues

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!

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):

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!

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!

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

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 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 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 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 if without momentum, parameters should not change too
Severity: Minor
Found in slm_lab/agent/net/net_util.py by fixme

TODO found
Open

    # TODO expand to be more comprehensive
Severity: Minor
Found in slm_lab/spec/spec_util.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

        else:  # TODO retrieve lr more generally
Severity: Minor
Found in slm_lab/agent/net/net_util.py by fixme

TODO found
Open

    TODO support for other ray search algorithms: https://ray.readthedocs.io/en/latest/tune-searchalg.html
Severity: Minor
Found in slm_lab/experiment/search.py by fixme
Severity
Category
Status
Source
Language