23ws-LLMcoder/LLMcoder-GitHub-Python-Mix-Direct
Dataset Card for LLMcoder-GitHub-Python-Mix-Direct Python target autocomplete suggestions in the format of conversations for OpenAI's fine-tuning. Dataset Details Dataset Description Curated by: [More Information Needed] Funded by [optional]: [More Information Needed] Shared by [optional]: [More Information Needed] Language(s) (NLP): [More Information Needed] License: [More Information Needed] Dataset Sources [optional] The data… See the full description on the dataset page: https://huggingface.co/datasets/23ws-LLMcoder/LLMcoder-GitHub-Python-Mix-Direct.
0216
1ave_okay'] = slave_okay2 client = pymongo.MongoClient(**options)3 4 if ensure_direct:5 # make sure we are connected to mongod/mongos that was specified; mongodb drivers6 # have the tendency of doing "magical" things in terms of connecting to other boxes7 test_collection = client['local']['test']8 test_cursor = test_collection.find(slave_okay=True, limit=1)9 connection = test_cursor.collection.database.connection10 if connection.host != host or connection.port != port:11 raise ValueError("connected to %s:%d (expected %s:%d)" %12 (connection.host, connection.port, host, port))13 14 return client15 16 17def parse_mongo_url(url):18 """19 Takes in pseudo-URL of form20 21 host[:port]/db/collection (e.g. localhost/prod_maestro/emails)22 23 and returns a dictionary containing elements 'host', 'port', 'db', 'collection'24 """25 try:26 host, db, collection = url.split('/')27 except ValueError:28 raise ValueError("urls be of format: host[:port]/db/collection")29 30 host_tokens = host.split(':')31 if len(host_tokens) == 2:32 host = host_tokens[0]33 port = int(host_tokens[1])34 elif len(host_tokens) == 1:35 port = 2701736 elif len(host_tokens) > 2:37 raise ValueError("urls be of format: host[:port]/db/collection")38 39 return dict(host=host, port=port, db=db, collection=collection)40 41 42def _source_file_syntax():43 print "--source files must be of the following format:"44 print "database_name.collection_name"45 print "mongo-shard-1.foo.com"46 print "mongo-shard-2.foo.com:27019"47 print "..."48 sys.exit(1)49 50 51def parse_source_file(filename):52 """53 parses an input file passed to the --source parameter as a list of dicts that contain54 these fields:55 56 host57 port58 db: database name59 collection60 """61 sources = []62 63 with open(filename, "r") as source_file:64 fullname = source_file.readline().strip()65 try:66 db, collection = fullname.split('.')67 except ValueError:68 _source_file_syntax()69 70 