This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This demonstrates doing multiple metadata fetches in parallel. | |
# It seems to be fast enough that the json decoding cost becomes | |
# a significant proportion of the execution time. | |
# It requires gevent; see http://www.gevent.org/intro.html#installation | |
# This is callable from the command line; call with --help for a summary. | |
# If you use it is a library, the main entry point is | |
# metadata_record_iterator(); see main() for an example. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib | |
import collections | |
def get_iterable(x): | |
return (x,) if not isinstance(x, (tuple, list)) else x | |
# if isinstance(x, collections.Iterable): | |
# return x | |
# else: | |
# return (x,) |