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

SyntaxWarning: "is not" with a literal #2713 #2722

Merged

Conversation

phillxnet
Copy link
Member

Modify conditionals to address Py3.8's added warnings.

Fixes #2713

Testing

Post the proposed changes we have:

lbuildvm:/opt/rockstor/src/rockstor # poetry run python -Wd /opt/rockstor/.venv/bin/django-admin test -v 2
/opt/rockstor/.venv/lib/python3.9/site-packages/django/utils/version.py:98: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  loose_version = LooseVersion(version)
Creating test database for alias 'default' ('test_storageadmin')...
...
----------------------------------------------------------------------
Ran 278 tests in 27.020s

OK
...

With the remaining warning pertaining to #2696 Re Py3.10 and our Django.

Modify conditionals to address Py3.8's added warnings.
@phillxnet
Copy link
Member Author

phillxnet commented Oct 21, 2023

Testing follow-up

  • Before, during rpmbuild:
+ cd src/rockstor/
+ poetry run django-admin test
/home/buildbot/worker/Poetry-Build-on-Leap15-5/rpmbuild/rockstor-core-5.0.5-2721/src/rockstor/system/luks.py:241: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if container_dev is not "":
/home/buildbot/worker/Poetry-Build-on-Leap15-5/rpmbuild/rockstor-core-5.0.5-2721/src/rockstor/system/luks.py:351: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if len(source_dev_fields) is not 2:
/home/buildbot/worker/Poetry-Build-on-Leap15-5/rpmbuild/rockstor-core-5.0.5-2721/src/rockstor/storageadmin/views/email_client.py:204: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if len(line) > 0 and line[0] is not "#":
/home/buildbot/worker/Poetry-Build-on-Leap15-5/rpmbuild/rockstor-core-5.0.5-2721/src/rockstor/storageadmin/views/rockon_helpers.py:239: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if new_state is not "pending_update" and task is not None:
/home/buildbot/worker/Poetry-Build-on-Leap15-5/rpmbuild/rockstor-core-5.0.5-2721/src/rockstor/storageadmin/views/rockon_helpers.py:239: SyntaxWarning: "is not" with a literal. Did you mean "!="?
  if new_state is not "pending_update" and task is not None:
/home/buildbot/worker/Poetry-Build-on-Leap15-5/rpmbuild/rockstor-core-5.0.5-2721/src/rockstor/storageadmin/views/rockon_helpers.py:379: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if c.uid is -1:
Creating test database for alias 'default'...
Creating test database for alias 'smart_manager'...
...
  • After proposed change:
+ cd src/rockstor/
+ poetry run django-admin test
Creating test database for alias 'default'...
Creating test database for alias 'smart_manager'...
...

So all linked issue warnings are resolved.

@phillxnet phillxnet merged commit 1269064 into rockstor:testing Oct 21, 2023
@phillxnet phillxnet deleted the 2713-SyntaxWarning-is-not-with-a-literal branch October 21, 2023 18:54
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

Successfully merging this pull request may close these issues.

1 participant