262f2dd76cd516d0be4a73e87e72a39938a18795,poseidon/poseidonStorage/poseidonStorage.py,db_collection_query,on_get,#db_collection_query#Any#Any#Any#Any#Any#,155
Before Change
def on_get(self, req, resp, database, collection, query_str):
try:
query = urllib.unquote(query_str).decode("utf8")
query = ast.literal_eval(query_str)
cursor = self.client[database][collection].find(query)
ret = ""
for doc in cursor:
ret += json.dumps(doc)
After Change
def on_get(self, req, resp, database, collection, query_str):
ret = {}
try:
query = bson.BSON.decode(query_str)
cursor = self.client[database][collection].find(query)
doc_dict = {}
if cursor.count() == 0:
ret["count"] = cursor.count()
ret["docs"] = "Valid query performed, no docs found."
else:
for doc in cursor:
doc_dict[doc["node_ip"]] = doc
ret["docs"] = doc_dict
ret["count"] = cursor.count()
ret = json.dumps(ret)
except:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: CyberReboot/poseidon
Commit Name: 262f2dd76cd516d0be4a73e87e72a39938a18795
Time: 2016-08-10
Author: tlanham@cs.stanford.edu
File Name: poseidon/poseidonStorage/poseidonStorage.py
Class Name: db_collection_query
Method Name: on_get
Project Name: explosion/spaCy
Commit Name: 01858e9b5972a8c1dec86f88eef3f17fea63cdc6
Time: 2017-09-20
Author: honnibal+gh@gmail.com
File Name: examples/multi_word_matches.py
Class Name:
Method Name: read_gazetteer
Project Name: alfredfrancis/ai-chatbot-framework
Commit Name: 283c21ffe41229dcc9790ae400b6833c50960a57
Time: 2016-07-02
Author: alfred.francis@pearldatadirect.com
File Name: ikyCore/sequenceLabeler.py
Class Name:
Method Name: train