Skip to content

Commit

Permalink
Completed the core update to python 3 and move from setup to pyproject.
Browse files Browse the repository at this point in the history
Moved query_yes_or_no to update_signatures where it was used.
Removed from __future__ import print_function
Removed from __future__ import absolute_import
Removed use of cStringIO and replaced with IO.StringIO
Removed dependency `six`, including `six.moves`, `six.moves.range`, `six.moves.iteritems`, `six.PY2`, `six.urllib`
Removed `importlib_resources`
  • Loading branch information
adamfarquhar committed Sep 10, 2024
1 parent f4dd41a commit d3905f3
Show file tree
Hide file tree
Showing 10 changed files with 766 additions and 608 deletions.
2 changes: 2 additions & 0 deletions fido/pronom/http.py → .attic/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"""
from six.moves import urllib

# NOTE: from fido/pronom/


def get_sig_xml_for_puid(puid):
"""Return the full PRONOM signature XML for the passed PUID."""
Expand Down
37 changes: 2 additions & 35 deletions fido/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,9 @@
It is designed for simple integration into automated work-flows.
"""

from __future__ import print_function

from os.path import abspath, dirname, join

from six.moves import input as rinput

__version__ = "1.8.0dev"

# todo: move this to a conf/conf.py or something rather than init.py. Would require some cascading updates, though
from os.path import abspath, dirname, join

CONFIG_DIR = join(abspath(dirname(__file__)), "conf")


def query_yes_no(question, default="yes"):
"""
Ask a yes/no question via input() and return their answer.
`question` is a string that is presented to the user. `default` is the
presumed answer if the user just hits <Enter>. It must be "yes" (the
default), "no" or None (meaning an answer is required of the user).
The "answer" return value is True for "yes" or False for "no".
"""
valid = {"yes": True, "y": True, "no": False, "n": False}
if default is None:
prompt = " [y/n] "
elif default == "yes":
prompt = " [Y/n] "
elif default == "no":
prompt = " [y/N] "
else:
raise ValueError('Invalid default answer: "%s"' % default)
while True:
print(question + prompt, end="")
choice = rinput().lower()
if default is not None and choice == "":
return valid[default]
if choice in valid:
return valid[choice]
print('Please respond with "yes" or "no" (or "y" or "n").')
Loading

0 comments on commit d3905f3

Please sign in to comment.