Skip to content

Commit

Permalink
Update for recent Python version
Browse files Browse the repository at this point in the history
At some point, apparently Python 3.3, collections.Mapping moved to
collections.abc.Mapping [0]. Update the import accordingly.

[0] https://docs.python.org/3/library/collections.abc.html
  • Loading branch information
qmonnet committed Aug 11, 2022
1 parent cd829a0 commit a1d4fca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion sphinxcontrib/openapi/renderers/_httpdomain.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
"""OpenAPI spec renderer."""

import collections
import sys
if sys.version_info >= (3, 3):
import collections.abc as collections
else:
import collections

import copy
import functools
import http.client
Expand Down

2 comments on commit a1d4fca

@flokli
Copy link

@flokli flokli commented on a1d4fca Aug 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks rendering docs for me entirely, becausecollections.abc doesn't contain defaultdict.

The docs for collections.abc mention:

This module provides abstract base classes that can be used to test whether a class provides a particular interface; for example, whether it is hashable or whether it is a mapping.

I think this should import both collections.abc and collections, and get the different things from the corresponding package, but simply importing collections.abc as collections doesn't work.

@flokli
Copy link

@flokli flokli commented on a1d4fca Aug 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I sent #1 which should address this, PTAL.

Please sign in to comment.