Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix linter error for type comparison #857

Open
nsmith- opened this issue Sep 7, 2023 · 0 comments
Open

Fix linter error for type comparison #857

nsmith- opened this issue Sep 7, 2023 · 0 comments

Comments

@nsmith-
Copy link
Collaborator

nsmith- commented Sep 7, 2023

In the code we use a lot of type(x) == y conditionals, e.g.

if ret.obs != [] and type(ret.obs) == list: # still as list, must change into map with bin names
ret.obs = dict([(b, ret.obs[i]) for i, b in enumerate(ret.bins)])

which recently started being checked by flake8, e.g.

./python/DatacardParser.py:450:38: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`

A few quick changes, e.g. to isinstance(x, y) would suppress these. For now I've silenced the warning in #856

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant