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 deprecated basestring with str (Py3) #722

Merged
merged 3 commits into from
Apr 3, 2020
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
8 changes: 7 additions & 1 deletion src/aliceVision/sensorDB/sensorDatabaseSort.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@

import argparse

try:
_ = basestring
except NameError:
# 'basestring' is undefined, so it must be Python 3
basestring = (str, bytes)

# command line
parser = argparse.ArgumentParser(description='Sort sensor width camera database by the brand / model name')
parser.add_argument('-i', '--input', metavar='inputSensorDatabase.txt', required=True, type=str,
Expand All @@ -24,7 +30,7 @@

# process
sensors = [entry.split(';') for entry in database]
sensors.sort(key=lambda t : tuple(s.lower() if isinstance(s,basestring) else s for s in t))
sensors.sort(key=lambda t : tuple(s.lower() if isinstance(s, basestring) else s for s in t))
outDatabase = ""
for entry in sensors:
outDatabase += ';'.join(entry)
Expand Down