コード例 #1
0
ファイル: view_ansi.py プロジェクト: ychaim/rate.sx
def _colorize_entries(entries):
    """
    Colorize table <entries>
    """

    data = []

    for rank, entry in enumerate(entries):
        code = entry['code']
        price = entry['price']
        change_24h = entry['change_24h']
        change_1h = entry['change_1h']
        cap = entry['cap']
        s_spark = spark.spark(entry['spark'])

        if change_24h != '-':
            change_24h = colorize_number("%.2f%%" % change_24h)

        if change_1h != '-':
            change_1h = colorize_number("%.2f%%" % change_1h)

        code = colored(code, 'cyan')
        price = colored(to_precision(price, 6), 'cyan')
        cap = human_format(cap)

        data.append(
            [rank + 1, code, price, change_24h, change_1h, cap, s_spark])

    return data
コード例 #2
0
def main():
    itap = mydb.Database('itap')
    select = """
SELECT
    steps steps ,
    datestamp date,
    DATE_FORMAT( datestamp , "%Y" ) year ,
    YEARWEEK(datestamp) month ,
    DATE_FORMAT( datestamp , "%a" ) day 
FROM fitbit_daily
ORDER BY datestamp
DESC LIMIT 7
"""
    data = itap.db_array(select)
    steps = []
    reverse = []
    for row in data:
        step = row[0]
        steps.append(step)
        reverse.insert(0, step)
    stepspark = spark.spark(reverse)
    print stepspark
コード例 #3
0
def main():
    itap = mydb.Database( 'itap' )
    select = """
SELECT
    steps steps ,
    datestamp date,
    DATE_FORMAT( datestamp , "%Y" ) year ,
    YEARWEEK(datestamp) month ,
    DATE_FORMAT( datestamp , "%a" ) day 
FROM fitbit_daily
ORDER BY datestamp
DESC LIMIT 7
"""
    data = itap.db_array(select)
    steps = []
    reverse = []
    for row in data:
        step = row[0]
        steps.append( step )
        reverse.insert( 0 , step )
    stepspark = spark.spark( reverse )
    print stepspark
コード例 #4
0
ファイル: spark_client.py プロジェクト: Flipkart/ambari
    def configure(self, env):
        import params

        env.set_params(params)
        spark(env)
コード例 #5
0
ファイル: collect_data.py プロジェクト: the-resident/rate.sx
def generate_spark(code, number_of_ticks=11):
    filename = 'data/%s' % code
    lines = get_last_line(filename, number_of_ticks)
    vals = [float(x.split()[1]) for x in lines]
    return spark.spark(vals)
コード例 #6
0
ファイル: spark_handler.py プロジェクト: keedio/keedio-stacks
 def configure(self, env):
   import params
   env.set_params(params)
   spark(action="config")
コード例 #7
0
ファイル: spark_handler.py プロジェクト: alcuma/keedio-stacks
 def configure(self, env):
     import params
     env.set_params(params)
     spark(action="config")
コード例 #8
0
 def start(self, env):
   import params
   env.set_params(params)
   self.configure(env)
   spark(action="upload_jar")
   spark_hs(action="start")
コード例 #9
0
 def start(self, env):
     import params
     env.set_params(params)
     self.configure(env)
     spark(action="upload_jar")
     spark_hs(action="start")