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

Replace use of _ast with ast #393

Closed
wants to merge 1 commit into from
Closed

Replace use of _ast with ast #393

wants to merge 1 commit into from

Conversation

ericwb
Copy link
Member

@ericwb ericwb commented Oct 1, 2018

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

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>
@ehooo
Copy link
Contributor

ehooo commented Oct 9, 2018

The python 3.8 will remove all types like Num, Str, Bytes, NameConstant and Ellipsis.

Deprecated since version 3.8: Class ast.Constant is now used for all constants. Old classes ast.Num, ast.Str, ast.Bytes, ast.NameConstant and ast.Ellipsis are still available, but they will be removed in future Python releases.

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):
Copy link
Contributor

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'

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,

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):

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

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.

@tylerwince
Copy link
Contributor

this can be closed and is included in #509

@ericwb
Copy link
Member Author

ericwb commented Jul 2, 2019

Fixed with #509

@ericwb ericwb closed this Jul 2, 2019
openstack-mirroring pushed a commit to openstack/oslo.cache that referenced this pull request Jul 23, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Jul 23, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.concurrency that referenced this pull request Jul 25, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Jul 25, 2020
* 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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Jul 28, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.messaging that referenced this pull request Jul 28, 2020
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>
openstack-mirroring pushed a commit to openstack/castellan that referenced this pull request Jul 28, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Jul 28, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.rootwrap that referenced this pull request Aug 3, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 3, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.i18n that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/oslo.middleware that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.context that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.versionedobjects that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.policy that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/oslo.config that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.log that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/oslo.vmware that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.limit that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.serialization that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/oslo.service that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.reports that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/oslo.db that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/osprofiler that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.privsep that referenced this pull request Aug 6, 2020
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>
openstack-mirroring pushed a commit to openstack/openstack that referenced this pull request Aug 6, 2020
* 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>
openstack-mirroring pushed a commit to openstack/oslo.utils that referenced this pull request Aug 6, 2020
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>
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.

None yet

4 participants