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" with a literal #210

Closed
ionutnechita opened this issue Oct 9, 2020 · 1 comment
Closed

SyntaxWarning: "is" with a literal #210

ionutnechita opened this issue Oct 9, 2020 · 1 comment

Comments

@ionutnechita
Copy link

Hi,

I observe this warning:
SyntaxWarning: "is" with a literal
visitor.py. line 32,34,260

Ubuntu 20.04.1 LTS
python3 --version
Python 3.8.2

@GMTSE
Copy link

GMTSE commented Jun 7, 2021

Hi,

When I install python3-jmespath (version 0.9.4-2) using apt, I also get similar warnings:

Setting up python3-jmespath (0.9.4-2) ...
/usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if x is 0 or x is 1:
/usr/lib/python3/dist-packages/jmespath/visitor.py:32: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if x is 0 or x is 1:
/usr/lib/python3/dist-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif y is 0 or y is 1:
/usr/lib/python3/dist-packages/jmespath/visitor.py:34: SyntaxWarning: "is" with a literal. Did you mean "=="?
  elif y is 0 or y is 1:
/usr/lib/python3/dist-packages/jmespath/visitor.py:260: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if original_result is 0:

Looks like bugs to me, as the is keyword in Python is used to "Check if two objects are the same object" (i.e. check references), and 0and1` are not objects/references...

bors bot added a commit to meilisearch/meilisearch-aws that referenced this issue Jun 20, 2022
97: Bump jmespath from 1.0.0 to 1.0.1 r=alallema a=dependabot[bot]

Bumps [jmespath](https://github.com/jmespath/jmespath.py) from 1.0.0 to 1.0.1.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/jmespath/jmespath.py/blob/develop/CHANGELOG.rst">jmespath's changelog</a>.</em></p>
<blockquote>
<h1>1.0.1</h1>
<ul>
<li>Add support for Python 3.11
(<code>issue [#285](jmespath/jmespath.py#285) &lt;https://github.com/jmespath/jmespath.py/issues/285&gt;</code>__)</li>
<li>Fix boolean correctness for floats
(<code>issue [#281](jmespath/jmespath.py#281) &lt;https://github.com/jmespath/jmespath.py/issues/281&gt;</code>__)</li>
<li>Fix Python 3.9 warning about random sampling used in parser cache.
(<code>issue [#216](jmespath/jmespath.py#216) &lt;https://github.com/jmespath/jmespath.py/issues/216&gt;</code>__)</li>
<li>Fix Python 3.8 warning for type comparisons
(<code>issue [#210](jmespath/jmespath.py#210) &lt;https://github.com/jmespath/jmespath.py/issues/268&gt;</code>__)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/jmespath/jmespath.py/commit/e600d11e5d4e90b0d7f67882756fffc90a52eb36"><code>e600d11</code></a> Merge branch 'release-1.0.1' into master</li>
<li><a href="https://github.com/jmespath/jmespath.py/commit/42b28dadc328606c4482745f07df29100d5f13c2"><code>42b28da</code></a> Bump version to 1.0.1</li>
<li><a href="https://github.com/jmespath/jmespath.py/commit/70cf143bb89eb32770d114b0ab84705970f1f8e6"><code>70cf143</code></a> Merge branch '3.11' into develop</li>
<li><a href="https://github.com/jmespath/jmespath.py/commit/5a9eb364e89f98c2f3367bd04a9b3580ecd47b19"><code>5a9eb36</code></a> Add testing for Python 3.11</li>
<li><a href="https://github.com/jmespath/jmespath.py/commit/da70f4ea94609f87d1ccd3b50809ea8b09cfa47f"><code>da70f4e</code></a> Merge branch 'sync-tests' into develop</li>
<li><a href="https://github.com/jmespath/jmespath.py/commit/ebad3021e3ae2a67ad68dd60aa1ef111f4ace3a5"><code>ebad302</code></a> Sync upstream test from jmespath.test</li>
<li><a href="https://github.com/jmespath/jmespath.py/commit/9eb120d75cab800117c2e6649f27e3a37a9b7748"><code>9eb120d</code></a> Merge branch 'float_fix' into develop</li>
<li><a href="https://github.com/jmespath/jmespath.py/commit/0cb65901fa987684764190d7146a398a7d5c584c"><code>0cb6590</code></a> Merge branch 'changelog10' into develop</li>
<li><a href="https://github.com/jmespath/jmespath.py/commit/48a029549ea8c74561fe10c9f4062c1a10cc4da0"><code>48a0295</code></a> Add additional compliance tests for verifying float/boolean correctness</li>
<li><a href="https://github.com/jmespath/jmespath.py/commit/bd6cdba2e184af7a2d2799f03a17eacc27ebd9d1"><code>bd6cdba</code></a> Merge branch 'py38_warning' into develop</li>
<li>Additional commits viewable in <a href="https://github.com/jmespath/jmespath.py/compare/1.0.0...1.0.1">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=jmespath&package-manager=pip&previous-version=1.0.0&new-version=1.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

You can trigger a rebase of this PR by commenting ``@dependabot` rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- ``@dependabot` rebase` will rebase this PR
- ``@dependabot` recreate` will recreate this PR, overwriting any edits that have been made to it
- ``@dependabot` merge` will merge this PR after your CI passes on it
- ``@dependabot` squash and merge` will squash and merge this PR after your CI passes on it
- ``@dependabot` cancel merge` will cancel a previously requested merge and block automerging
- ``@dependabot` reopen` will reopen this PR if it is closed
- ``@dependabot` close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- ``@dependabot` ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- ``@dependabot` ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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

2 participants