Skip to content

Commit

Permalink
collections.abc and pytest warning fixes (#1898)
Browse files Browse the repository at this point in the history
  • Loading branch information
jvesely authored Feb 2, 2021
2 parents 06db0d1 + 97f1147 commit ab56672
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions psyneulink/core/components/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,9 +1292,9 @@ def _get_compilation_state(self):
if not hasattr(self, 'ports'):
blacklist.add("value")
def _is_compilation_state(p):
val = p.get() # memoize for this function
return val is not None and p.name not in blacklist and \
(p.name in whitelist or isinstance(val, Component))
#FIXME: This should use defaults instead of 'p.get'
return p.name not in blacklist and \
(p.name in whitelist or isinstance(p.get(), Component))

return filter(_is_compilation_state, self.parameters)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ class Parameters(Function_Base.Parameters):

def _validate_noise(self, noise):
if (
isinstance(noise, collections.Iterable)
isinstance(noise, collections.abc.Iterable)
# assume ComponentsMeta are functions
and contains_type(noise, ComponentsMeta)
):
Expand Down
2 changes: 1 addition & 1 deletion psyneulink/core/globals/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ def gen_friendly_comma_str(items):


def contains_type(
arr: collections.Iterable,
arr: collections.abc.Iterable,
typ: typing.Union[type, typing.Tuple[type, ...]]
) -> bool:
"""
Expand Down
4 changes: 3 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ addopts =
--pydocstyle
--pycodestyle
--strict-markers
--strict-config
--ignore=Scripts

markers =
Expand Down Expand Up @@ -57,7 +58,8 @@ markers =
model: Tests based on existing models
pytorch: Tests using Torch

pytest_plugins = ['pytest_profiling', 'helpers_namespace', 'benchmark']
# These are needed for test fixtures or default parameters
required_plugins = pytest-benchmark pytest-cov pytest-helpers-namespace pytest-pycodestyle pytest-pydocstyle pytest-xdist

xfail_strict = True

Expand Down

0 comments on commit ab56672

Please sign in to comment.