← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1936667] Re: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3

 

Reviewed:  https://review.opendev.org/c/openstack/swift/+/801095
Committed: https://opendev.org/openstack/swift/commit/775ad9a56882b387e834eae7635f9f1ffa7c2f2c
Submitter: "Zuul (22348)"
Branch:    master

commit 775ad9a56882b387e834eae7635f9f1ffa7c2f2c
Author: Takashi Kajinami <tkajinam@xxxxxxxxxx>
Date:   Sat Jul 17 01:07:54 2021 +0900

    Remove redundant usage of collections(.abc).Mapping
    
    The json.loads method returns a normal python dict without any hook
    defined, and type check using the Mapping class is redundant.
    
    In Python 3.8
    >>> import json
    >>> type(json.loads('{"foo": {"var": "baz"}}'))
    <class 'dict'>
    
    In Python 2.7
    >>> import json
    >>> type(json.loads('{"foo": {"var": "baz"}}'))
    <class 'dict'>
    
    With this change we don't have to handle difference between Python 2
    and Python 3 and later about import path we should use to import that
    abstract class
    
    Closes-Bug: #1936667
    Change-Id: I9232311784d1feff2d669455dafde17ed9f751ad


** Changed in: swift
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Identity (keystone).
https://bugs.launchpad.net/bugs/1936667

Title:
  Using or importing the ABCs from 'collections' instead of from
  'collections.abc' is deprecated since Python 3.3

Status in OpenStack Identity (keystone):
  In Progress
Status in OpenStack Shared File Systems Service (Manila):
  In Progress
Status in Mistral:
  In Progress
Status in neutron:
  In Progress
Status in OpenStack Object Storage (swift):
  Fix Released
Status in taskflow:
  Fix Released
Status in tempest:
  In Progress
Status in zaqar:
  In Progress

Bug description:
  Using or importing the ABCs from 'collections' instead of from
  'collections.abc' is deprecated since Python 3.3.

  For example:

  >>> import collections 
  >>> collections.Iterable
  <stdin>:1: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.10 it will stop working
  <class 'collections.abc.Iterable'>

  >>> from collections import abc
  >>> abc.Iterable
  <class 'collections.abc.Iterable'>

To manage notifications about this bug go to:
https://bugs.launchpad.net/keystone/+bug/1936667/+subscriptions



References