Skip to content

Commit

Permalink
Merge pull request #2 from mrbrendall/print_logs
Browse files Browse the repository at this point in the history
Update get_top_level_apis to be compatible with Python 3.6
  • Loading branch information
paultiplady committed Jul 16, 2018
2 parents 3ea3e8a + 7e655ad commit c0bfd53
Showing 1 changed file with 5 additions and 2 deletions.
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

0 comments on commit c0bfd53

Please sign in to comment.