Example #1
0
def main():
    rgspath=arcpy.GetParameterAsText(0)
    mapindexpath=arcpy.GetParameterAsText(0)
    ymdhms = datetime.datetime.now().strftime(u"%Y%m%d%H%M%S")
    createDB(rgspath,u"rgs",ymdhms)
    createDB(mapindexpath, u"mapindex", ymdhms)
    return True
Example #2
0
import createDB
import dataGeneration
import graphSelection

if __name__ == "__main__":
    DATA_GENERATION = False

    # Create new databases
    if DATA_GENERATION:

        # Create list with amount of days in each month
        months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

        # Loop through number of months in a year
        for month in range(1, 13):

            # Loop through amount of days per month
            for day in range(1, (months[month-1])+1):
                new_db_name = (str(month) + "-" + str(day) + "-2016.db")
                database = createDB.createDB(new_db_name)
                dataGeneration.dataGeneration(database)

    # Open the GUI
    GUI = graphSelection.GUI()
import parse_stock_data
import calculate_stock_spec
import datetime
import os
import baostock as bs
import createDB

if __name__ == '__main__':

    createDB.createDB()

    current_date = datetime.date.today().strftime('%Y-%m-%d')
    hour = datetime.datetime.now().hour
    #baostock data maybe not update right after the trade market close.
    if hour < 20:
        dd = datetime.date.today() + datetime.timedelta(-1)
        current_date = dd.strftime('%Y-%m-%d')

    start_date = "2017-01-01"

    data_list = []
    bs.login()
    rs = bs.query_trade_dates(start_date=start_date, end_date=current_date)
    while (rs.error_code == '0') & rs.next():
        data_list.append(rs.get_row_data())
    bs.logout()
    lastTradeDate = current_date
    for i in range(len(data_list) - 1, -1, -1):
        if data_list[i][1] == '1':
            lastTradeDate = data_list[i][0]
            break
Example #4
0
def TwELEC():

    # Fetch form values
    # and replace the default values
    if request.method == 'POST':

        mandatory_keywords=request.form['mkw'].split(" ")

        try:
           passd=request.form['mdp']
           if passd != s_password:
              return(render_template("error.html",cause="Echec authentification"))
        except KeyError:
              return(render_template("error.html",cause="Echec authentification"))
        
        try:
           optional_keywords=request.form['okw'].split(" ")
        except KeyError:
           optional_keywords=[]

        try:
            hours_before=request.form['hbf']
            if hours_before == '':
                hours_before=-1
            else:
                try:
                    hours_before=int(hours_before)
                except ValueError:
                    hours_before=-1
        except KeyError:
            hours_before=-1

        try:
            max_search_hits=request.form['shts']
            if max_search_hits == '':
                max_search_hits=35
            else:
                try:
                    max_search_hits=int(max_search_hits)
                except ValueError:
                    max_search_hits=35
        except KeyError:
            max_search_hits=35
            
    else:
        return(render_template("error.html",cause="Wrong method"))
        
    createDB.createDB()
    fetchTweets.fetchTweets(a_token,
                            a_secret,
                            c_key,
                            c_secret,
                            session_name,
                            mandatory_keywords,
                            optional_keywords,
                            hours_before,
                            language_string,
                            hits_page_size,
                            max_search_hits)
    processTweets.processTweets()
    return(displayToStr.displayToStr())
Example #5
0
# Maximum number of search hits
# may be more depending on
# next multiple of hits_page_size
max_search_hits=35


# Keys to access the twitter API
c_key = ''
c_secret = ''
a_token = ''
a_secret = ''


#####################################################

createDB.createDB()
fetchTweets.fetchTweets(a_token,
                        a_secret,
                        c_key,
                        c_secret,
                        session_name,
                        mandatory_keywords,
                        optional_keywords,
                        hours_before,
                        language_string,
                        hits_page_size,
                        max_search_hits)

processTweets.processTweets()
displayToHTML.displayToHTML()
Example #6
0
network = 'irc.freenode.net'
port = 6667
channels = ['##bottest',]
nick = 'spiffybot'
realName = 'spiffybot'

# Enable debug mode if the appropriate command line parameter was passed
if len(sys.argv) > 1 and sys.argv[1] == "--debug":
    DEBUG = True
else:
    DEBUG = False

# Open the database
dbName = "logs.db"
if not os.path.exists(dbName):
    createDB(dbName)
dbConn = sqlite.connect(dbName)
cursor = dbConn.cursor()


def main():
    # Create an IRC object
    irc = irclib.IRC()
    if DEBUG:
        irclib.DEBUG = True  # Uncomment this to dump all irclib events to stdout

    # Create a server object, connect and join the channels
    global server
    server = irc.server()
    server.connect(network, port, nick, ircname = realName)
    joinChannels()
Example #7
0
import createDB
import dataGeneration
import graphSelection

if __name__ == "__main__":
    DATA_GENERATION = False

    # Create new databases
    if DATA_GENERATION:

        # Create list with amount of days in each month
        months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]

        # Loop through number of months in a year
        for month in range(1, 13):

            # Loop through amount of days per month
            for day in range(1, (months[month - 1]) + 1):
                new_db_name = (str(month) + "-" + str(day) + "-2016.db")
                database = createDB.createDB(new_db_name)
                dataGeneration.dataGeneration(database)

    # Open the GUI
    GUI = graphSelection.GUI()