Skip to content

Commit

Permalink
Removed extraneous comments and whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Deep Ganguli committed Nov 18, 2013
1 parent 3fae2b7 commit c845eb5
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions pydruid/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ def __init__(self,url,endpoint):
self.result_json = None
self.query_type = None

# serializes a dict representation of the query into a json
# object, and sends it to bard via post, and gets back the
# json representation of the query result
def post(self,query):
querystr = json.dumps(query)
url = self.url + '/' + self.endpoint
Expand All @@ -49,8 +46,6 @@ def post(self,query):
self.querystr = querystr
res.close()

# de-serializes the data returned from druid into a
# list of dicts
def parse(self):
if self.result_json:
res = json.loads(self.result_json)
Expand All @@ -59,6 +54,8 @@ def parse(self):
print("Empty query")
return None

# --------- Export implementations ---------

def export_tsv(self,dest_path):

f = open(dest_path,'wb')
Expand All @@ -74,7 +71,6 @@ def export_tsv(self,dest_path):

tsv_file.writerow(header)

# use unicodewriter to encode results in unicode
w = query_utils.UnicodeWriter(f)

if self.result:
Expand All @@ -96,7 +92,6 @@ def export_tsv(self,dest_path):

f.close()

# Exports a JSON query object into a Pandas data-frame
def export_pandas(self):
if self.result:
if self.query_type == "timeseries":
Expand All @@ -112,7 +107,8 @@ def export_pandas(self):
df = pandas.DataFrame(nres)
return df

# implements a timeseries query
# --------- Query implementations ---------

def timeseries(self, **args):

query_dict = {"queryType" : "timeseries"}
Expand Down Expand Up @@ -141,7 +137,6 @@ def timeseries(self, **args):
self.query_type = "timeseries"
return self.result

# Implements a groupBy query
def groupBy(self, **args):

query_dict = {"queryType" : "groupBy"}
Expand Down Expand Up @@ -171,8 +166,6 @@ def groupBy(self, **args):
self.query_type = "groupby"
return self.parse()

# Implements a segmentMetadata query. This query type is for pulling the tsv-equivalent
# size and cardinality broken out by dimension in a specified data source.
def segmentMetadata(self, **args):

query_dict = {"queryType" : "segmentMetadata"}
Expand All @@ -194,7 +187,6 @@ def segmentMetadata(self, **args):
self.result = self.parse()
return self.parse()

# implements a time boundary query
def timeBoundary(self, **args):

query_dict = {"queryType" : "timeBoundary"}
Expand All @@ -213,7 +205,3 @@ def timeBoundary(self, **args):
else:
self.result = self.parse()
return self.parse()

# prints internal variables of the object
def describe(self):
print("url: " + self.url)

0 comments on commit c845eb5

Please sign in to comment.