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

Update get_top_level_apis to be compatible with Python 3.6 #2

Merged
merged 1 commit into from
Jul 16, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions rest_framework_swagger/urlparser.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re
import os
from collections import Set
from importlib import import_module

from django.conf import settings
Expand Down Expand Up @@ -96,8 +97,10 @@ def __filter_top_level_apis__(self, root_paths):

return list(filtered_paths)

def __get_base_path__(self, root_paths):
base_path = os.path.commonprefix(root_paths)
def __get_base_path__(self, root_paths: Set):
# Python 3.6 no longer accepts Sets to os.path.commonprefix.
paths = list(root_paths)
base_path = os.path.commonprefix(paths)
slash_index = base_path.rfind('/') + 1
base_path = base_path[:slash_index]

Expand Down