-
-
Notifications
You must be signed in to change notification settings - Fork 593
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
Replace use of _ast with ast #393
Conversation
Bandit shouldn't be using the protected version of the AST (_ast). This is likey to change and that's exactly what happened in Python 3.8 as they have deprecated the ast classes such as ast.Num and removed the _ast.Num. Signed-off-by: Eric Brown <browne@vmware.com>
The python 3.8 will remove all types like Num, Str, Bytes, NameConstant and Ellipsis.
However the code check this types before the version, so the error will continues happen |
@@ -199,50 +200,56 @@ def _get_literal_value(self, literal): | |||
:param literal: The AST literal to convert | |||
:return: The value of the AST literal | |||
''' | |||
if isinstance(literal, _ast.Num): | |||
if isinstance(literal, ast.Num): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On Python 3.8
AttributeError: module 'ast' has no attribute 'Num'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ast.Num
exists on Python 3.8. _ast.Num
is removed.
@@ -40,10 +41,10 @@ def __repr__(self): | |||
the string version of _context. | |||
|
|||
Example string returned: | |||
<Context {'node': <_ast.Call object at 0x110252510>, 'function': None, | |||
<Context {'node': <ast.Call object at 0x110252510>, 'function': None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The repr still contains <_ast.Call ...
@@ -199,50 +200,56 @@ def _get_literal_value(self, literal): | |||
:param literal: The AST literal to convert | |||
:return: The value of the AST literal | |||
''' | |||
if isinstance(literal, _ast.Num): | |||
if isinstance(literal, ast.Num): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ast.Num
exists on Python 3.8. _ast.Num
is removed.
literal_value = literal.s | ||
|
||
# NOTE(browne): Python 3.8 deprecates the constants such as ast.Num | ||
# in place of ast.Constant | ||
elif (sys.version_info >= (3, 8) and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ast.Constant
was introduced in 3.6.
this can be closed and is included in #509 |
Fixed with #509 |
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I8bce844a47a2af7abf2069bb8105eb7832c678e3 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.cache from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I8bce844a47a2af7abf2069bb8105eb7832c678e3 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I358b62b45096cfbcafe0e665d92e6b05fb36b153 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.concurrency from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I358b62b45096cfbcafe0e665d92e6b05fb36b153 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.messaging from branch 'master' - Merge "Bump bandit version" - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I9235560667f664643007b8ca0be1707eab4126ad Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I9235560667f664643007b8ca0be1707eab4126ad Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: Id913a9c9bedb7eb1366ac534ec1371945b0918a6 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update castellan from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: Id913a9c9bedb7eb1366ac534ec1371945b0918a6 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: Ic61bffb3845a53df14765194482f6264417d0ac7 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.rootwrap from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: Ic61bffb3845a53df14765194482f6264417d0ac7 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I0d07c9051addcbef37d48bfa84d612ef45ea105c Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I0b8b5a8899b22744cfd65b5e889a6283aec9ddfe Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.i18n from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I0d07c9051addcbef37d48bfa84d612ef45ea105c Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.middleware from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I0b8b5a8899b22744cfd65b5e889a6283aec9ddfe Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I2e498fd13356f571acb905384206b4c97e6c5d92 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.context from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I2e498fd13356f571acb905384206b4c97e6c5d92 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.versionedobjects from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I005962a63341bb8585141dfe5dcff3ea79560b87 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I005962a63341bb8585141dfe5dcff3ea79560b87 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.policy from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I0570c916cffc08bcbaebb385a9cc4a4c7038b215 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I0570c916cffc08bcbaebb385a9cc4a4c7038b215 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: Iec3897279cf81f951225f463450c6a1efd028b0b Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.config from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: Iec3897279cf81f951225f463450c6a1efd028b0b Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.log from branch 'master' - Merge "Bump bandit version" - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: Idca2a092bdfe762d23632e44e55be9290d692de8 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: Idca2a092bdfe762d23632e44e55be9290d692de8 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: If1e25c02adf0fb8f96f7bfb9134c5d170fab15eb Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.vmware from branch 'master' - Merge "Bump bandit version" - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: If1e25c02adf0fb8f96f7bfb9134c5d170fab15eb Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I568123c93c32cb224628c4a8371a9a0e7c19cf67 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.limit from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I568123c93c32cb224628c4a8371a9a0e7c19cf67 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: Ibde98a5e7e021e250b2a35008b677afa658ed47e Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I44b8f01489e503df0813ecac32639dc96c8a1c98 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.privsep from branch 'master' - Merge "Bump bandit version" - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I23fd4082e2566242b5fce093a4685c97663c947f Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.serialization from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: Ibde98a5e7e021e250b2a35008b677afa658ed47e Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.service from branch 'master' - Merge "Bump bandit version" - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I44b8f01489e503df0813ecac32639dc96c8a1c98 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.reports from branch 'master' - Merge "Bump bandit version" - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I4ccbdbb692e2e0b00a2517e2c5eb617756637ab0 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I4ccbdbb692e2e0b00a2517e2c5eb617756637ab0 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I44f0b485266d6a03d12953f3f45e476ba821a00c Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.db from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I44f0b485266d6a03d12953f3f45e476ba821a00c Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I883e2aae7918086be73579627e91325f9fe33b77 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update osprofiler from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I883e2aae7918086be73579627e91325f9fe33b77 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I23fd4082e2566242b5fce093a4685c97663c947f Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
* Update oslo.utils from branch 'master' - Bump bandit version This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I7b3144bd417f29cd57c16575ba47b45a4132aae7 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
This patch bumps bandit allowed version to >=1.6.0,<1.7.0 in order to avoid the errors detailed here PyCQA/bandit#393 Change-Id: I7b3144bd417f29cd57c16575ba47b45a4132aae7 Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
Bandit shouldn't be using the protected version of the AST (_ast).
This is likey to change and that's exactly what happened in Python
3.8 as they have deprecated the ast classes such as ast.Num and
removed the _ast.Num.
Signed-off-by: Eric Brown browne@vmware.com