def main():
    mongo_setup.global_init()
    print(Fore.CYAN + '''
            ********** Welcome To The Birds Motel **********
    Here You Can :- 

    [B]ook a cage for your bird.
    [O]ffer a cage for bird.
  ''')

    try:
        while 1:
            choice = input('''
        I'm a bird owner looking for a cage, press [B],
        I'm a cage owner renting a cage, press [O] 
>''')
            if choice.upper() == 'B':
                for_guest()
            elif choice.upper() == 'O':
                host.for_host()
            else:
                host.error_msg(' Wrong Input, Please Select The Correct One ')
    except KeyboardInterrupt:
        print('''
    ********** BYE **********
    ''')
        return
def main():
    mongo_setup.global_init()

    print_header()

    #down.downloader()
    #get_data()
    #get_data_distr()

    #generator.make_schools_full()

    #svc.generate_scores_all()

    #program_hosts.rate_class()
    #program_hosts.update_average_scores_everywhere()

    #an.analysis_students()
    #an.analysis_districts()

    #svc.add_districts_all()
    try:
        while True:
            if find_user_intent() == 'client':
                program_for_quest.run()
            else:
                program_hosts.run()
    except KeyboardInterrupt:
        return
Exemple #3
0
    def __init__(self, parent):
        super(RGB2CHLA, self).__init__(parent)
        # Base de datos
        mongo_setup.global_init()
        # Obtener datos de x - Valor NDVI
        tempx = svc.getAllNDVI()
        # Obtener datos de y - Valor Clorofila Laboratorio y SPAD
        templab = svc.getAllLAB()
        tempspad = svc.getAllSPAD()
        self.X = []
        # ylab = []
        self.ySpad = []
        for i in tempx:
            for j in i:
                if j > 0.1:
                    self.X.append([j])
                    # ylab.append(templab[tempx.index(i)])
                    self.ySpad.append(tempspad[tempx.index(i)])
        '''
        self.doc = load_workbook('Dataset.xlsx')
        self.sheets = self.doc.sheetnames
        self.hoja = self.doc[self.sheets[0]]
        self.filas = self.hoja.max_row+1

        self.X, self.ySpad = self.FromatRows()
        # Entrena con el 75% y predice con el 25% restante
        '''
        self.lrs, self.xTrain, self.yTrain, self.xTest, self.yTest, self.yPred = train(
            self.X, self.ySpad, 1, 1)
Exemple #4
0
def store_results(sort_map, array_gen_map):
    # setting the mongo db connection
    mongo_setup.global_init()
    # iterating over each sort and array generator
    for sort_name, sort_function in sort_map.items():
        sort_list = []
        for array_type, array_generator in array_gen_map.items():
            arrays = array_generator(1000, 1000)
            # time difference in nano seconds
            t = time.process_time() * (10**9)
            access_count = 0
            for arr in arrays:
                sorted_arr, count = sort_function(arr.copy())
                access_count += count
                check_sorting(sorted_arr)
            t1 = time.process_time() * (10**9)

            array = svc.create_array(arrays, array_type)
            sort = svc.create_sort(array, float(t1 - t), access_count)
            sort_list.append(sort)
            print(
                f'the time taken for {sort_name} using {array_type} arrays = {float(t1-t)}'
            )
        # storing the results in db
        sorttime = svc.create_sort_time(sort_name, sort_list)
Exemple #5
0
def main():
    mongo_setup.global_init()
    print_header()
    try:
        while True:
            product_manager.run()
    except KeyboardInterrupt:
        return
def save_ip(ip):
    mongo_setup.global_init(db_name='test_db')
    user = User()
    ip_address = ip_address_process()
    if ip_address:
        try:
            user.ip_address = ip_address
            user.save()
        except Exception as e:
            print(e.message)
Exemple #7
0
def main():
    mongo_setup.global_init()

    print_header()

    try:
        while True:
            program_users.run()
    except KeyboardInterrupt:
        return
Exemple #8
0
def run():
    mongo_setup.global_init()
    try:
        while True:
            if find_user_intent() == 'book':
                program_guests.run()
            else :
                program_hosts.run()
    except KeyboardInterrupt:
        return
def main():
    mongo_setup.global_init()

    print_header()

    try:
        while True:
            if find_user_intent() == 'book':
                program_guests.run()
            else:
                program_hosts.run()
    except KeyboardInterrupt:
        return
Exemple #10
0
def main():
    # TODO: Setup mongoengine global values
    mongo_setup.global_init()
    print_header()

    try:
        while True:
            if find_user_intent() == 'book':
                program_guests.run()
            else:
                program_hosts.run()
    except KeyboardInterrupt:
        return
def main():
    mongo_setup.global_init()

    print_header()

    try:
        while True:
            if find_user_intent() == "book":
                program_guests.run()
            else:
                program_hosts.run()
    except KeyboardInterrupt:
        return
Exemple #12
0
def main():
    mongo_setup.global_init()

    print_header()

    try:
        while True:
            if find_user_intent(
            ) == 'book':  #if the user wants to find an event
                program_tmembers.run()
            else:
                program_tmakers.run()  #if the user wants to create an event.
    except KeyboardInterrupt:
        return
Exemple #13
0
def main():
    # This is how the connections are registered
    mongo_setup.global_init()

    print_header()

    try:
        while True:
            if find_user_intent() == 'book':
                program_guests.run()
            else:
                program_hosts.run()
    except KeyboardInterrupt:
        return
Exemple #14
0
def main():
    secrets = read_secrets()
    mongo_setup.global_init(secrets)

    # svc.create_user("poog", "*****@*****.**")
    user = svc.find_user_by_email("*****@*****.**")
    print(user.email)
    # box = svc.find_box_by_id("5dbc8670e3e74473175d283f")
    # split = svc.find_split_by_id("5dbc8670e3e74473175d283e")
    #
    # svc.add_split_to_box(box, split)
    # svc.add_split_to_user
    app = fa.app
    uvicorn.run(app, host="0.0.0.0", port=8000)
Exemple #15
0
def main():
    mongo_setup.global_init()

    try:
        while True:
            choice = find_user_intent()
            if choice == 'book':
                program_guests.run()
            elif choice == 'offer':
                program_hosts.run()
            else:
                update()
    except KeyboardInterrupt:
        return
 def __init__(self):  # Inicializa todos los atributos y los widgets
     super(MainNDVI, self).__init__()
     self.setupUi(self)
     # Conectando botones a acciones
     self.loadRGBBtn.clicked.connect(self.loadRGBImage)
     self.loadNDVIBtn.clicked.connect(self.loadNDVIImage)
     self.selectBtn.clicked.connect(self.selectROI)
     # Conectando acciones del menú
     self.actionSalir.triggered.connect(self.salir_trigger)
     self.actionAbrir_imagen_RGB.triggered.connect(self.loadRGBImage)
     self.actionAbrir_imagen_NDVI.triggered.connect(self.loadNDVIImage)
     self.actionSeleccionar.triggered.connect(self.selectROI)
     self.actionGuardar_como.triggered.connect(self.saveAsImage)
     self.actionGuardar.triggered.connect(self.saveImage)
     mongo_setup.global_init()
Exemple #17
0
def main():
    mongo_setup.global_init('pypi')

    # td = TestDownload()
    # td.client = 'pip3'
    # td.version = '3.7'
    #
    # td.things.append(TestThing(name="Thing 1", size=7))
    # td.things.append(TestThing(name="Thing 2", size=5))
    #
    # td.save()

    print_header()
    print_direct()
    print_covered()
    input_loop()
Exemple #18
0
def main():

    # Setup MongoDB
    mongo_setup.global_init()

    print_header()

    try:
        while True:
            intent = find_user_intent()
            if intent == "dancer":
                program_dancers.run()
            elif intent == "studio":
                program_studios.run()
    except KeyboardInterrupt:
        return
Exemple #19
0
def main():
    # Setup mongoengine global values
    mongo_setup.global_init()
    print_header()

    try:
        while True:
            user_intent = find_user_intent()
            if user_intent == UserIntent.BOOK:
                program_guests.run()
            elif user_intent == UserIntent.OFFER:
                program_hosts.run()
            else:
                program_hosts.unknown_command()
    except KeyboardInterrupt:
        sys.exit(0)
def main():
    mongo_setup.global_init()
    my_tweeter_hashtag_manager = Tweeter_hashtag_manager()

    while True:
        print_header()

        choice = find_user_intent()
        space1 = "guatemala"#input("insert the first query ")
        space2 = "corrupcion"#input("insert the second query ")

        #space_names = [space1, space2]
        space_names = [space1, space2]
        node_type_name = "hashtag"
        graph_name = "hashtag"
        
        if choice == 'tweet':
            queries = [space1, space2]
            my_tweeter_hashtag_manager.fetch_tweeter_interaction(queries = queries, 
                space_names = space_names, 
                node_type_name = node_type_name)
        
        elif choice == 'nodes':
            my_tweeter_hashtag_manager.create_hashtag_interaction( 
                space_names = space_names, 
                node_type_name = node_type_name)

        elif choice == 'graph':
            my_tweeter_hashtag_manager.graph_hashtag_interaction(
                space_names = space_names, 
                graph_name = graph_name, 
                node_type_name = node_type_name)
        elif choice == 'describe':
            my_tweeter_hashtag_manager.graph_manager.descrive_graph(
                my_tweeter_hashtag_manager.graph_manager.g,
                space_names = space_names
            )
        elif choice == 'import':
            g = my_tweeter_hashtag_manager.graph_manager.import_graph(
                space_names = space_names
            )
            my_tweeter_hashtag_manager.graph_manager.descrive_graph(g, space_names = space_names)

        else:
            print("chose an option t,n,g ")
            return 'book'
Exemple #21
0
def main():
    mongo_setup.global_init(set_up_globals.database_name)
    print_header()

    while not state.active_account:
        try:
            response = log_into_account()
            if response in set_up_globals.exitResponseList:
                exit_app()

        except KeyboardInterrupt:
            return

    show_commands()

    try:
        while True:
            action = get_action()

            with switch(action) as s:
                s.case('a', import_assay_data)
                s.case('d', import_clinical_data)
                # s.case('r', import_redcap_data)
                s.case('b', import_biospecimen_data)
                # s.case('p', import_proteomics_data)
                s.case('scrna', import_scrnaseq_summary_data)
                s.case('dlt', import_data_label_types)
                s.case('compids', import_compound_ids)
                s.case('pathways', import_pathway_data)
                s.case('cdlt', combine_data_label_types)
                s.case('tp', test_pathway_mapping)
                s.case('vc', list_clinical_data)
                s.case('vb', list_biospecimen_data_for_study_id)
                s.case('vsc', list_biospecimen_data_for_scrnaseq_summary)
                s.case('vosc', list_only_scrnaseq_summary)
                s.case(set_up_globals.exitResponseList, exit_app)  # ['x', 'bye', 'exit', 'exit()']
                s.case('?', show_commands)
                s.case('', lambda: None)
                s.default(unknown_command)

            if action:
                print()

    except KeyboardInterrupt:
        return
def main():
    print("Fake data adder script")
    mongo_setup.global_init('pypi')

    t0 = datetime.datetime.now()

    if User.objects().count() > 0:
        print("Users exists, skipping...", flush=True)
        users = list(User.objects())
    else:
        users = build_users()

    if Package.objects().count() > 0:
        print("Packages exists, skipping...", flush=True)
        packages = list(Package.objects())
    else:
        packages = build_packages(users)

    if ReleaseHistory.objects().count() > 0:
        print("Releases exists, skipping...", flush=True)
        releases = list(ReleaseHistory.objects())
    else:
        releases = build_releases(packages)

    if Download.objects().count() > 0:
        print("Downloads exists, skipping...", flush=True)
        downloads = list(Download.objects())
        # sync_downloads(downloads)
    else:
        downloads = build_downloads(releases, packages)
        print("Syncing download count to packages ...", flush=True)
        # sync_downloads(downloads)

    t1 = datetime.datetime.now()
    dt = t1 - t0

    print(f"Created {user_count:,} users, {package_count:,} packages, "
          f"{release_count:,} releases, {download_count:,} downloads.")
    print(f"Total time: {dt.total_seconds():,} sec.")
Exemple #23
0
def create_tables():
    db.create_all()
    mongo_setup.global_init()

    if not models.UserModel.find_by_username('admin'):
        init_database_values()
from data.clinical_data import ClinicalData
from data.redcap import Redcap
from data.proteomics import Proteomic
from data.scrnaseq_summary import ScRNAseqSummary
from data.biospecimens import Biospecimen
from data.users import User

# Set up globals
import utilities
import set_up_globals

MECFSVersion = set_up_globals.MECFSVersion
data_folder = set_up_globals.data_folder

# Register connection to MongoDB
mongo_setup.global_init(database_name=set_up_globals.database_name)

# -------------------------------------------------------------------------------------
# Import data into pandas
scrnaseq_summary_data_list = svc.find_scrnaseq_summary_data_only()
if scrnaseq_summary_data_list is None:
    print(f'No scRNA-seq summary records.')
    sys.exit(2)

df, _ = utilities.create_df_from_object_list(scrnaseq_summary_data_list,
                                             [ScRNAseqSummary],
                                             ['scrnaseq_summary'])
print(df.head(5))

# Creating an ID column name gives us more interactive capabilities
df['id'] = df['study_id']
Exemple #25
0
def revoke_token_callback():
    return jsonify({
        'description': 'The User has Signed out',
        'error': 'signed_out'
    }), 401


api.add_resource(UserLogin, '/auth')
api.add_resource(UserRegister, '/register')
api.add_resource(UserArray, '/userarray')
api.add_resource(UserDetails, '/user/<string:username>')
api.add_resource(UserFromId, '/userfromid/<int:user_id>')
api.add_resource(TokenRefresh, '/refresh')
api.add_resource(UserLogOut, '/logout')

api.add_resource(Survey, '/survey')
api.add_resource(Surveydata, '/surveydata/<string:name>')
api.add_resource(Surveyresponse, '/surveyresponse')
api.add_resource(GetSurveyResponses, '/surveyresponses/<int:survey_id>')
api.add_resource(SurveyArray, '/surveyarray/<int:creator_id>')
api.add_resource(SurveyfromID, '/surveyfromid/<int:survey_id>')

api.add_resource(Template, '/template')
api.add_resource(Templatedata, '/templatedata/<string:name>')
api.add_resource(TemplateArray, '/templatearray')

mongo_setup.global_init()

if __name__ == '__main__':
    app.run(debug=True)
Exemple #26
0
def main():
    mongo_setup.global_init()
    program_actions.run()
Exemple #27
0
def main():
    mongo_setup.global_init()

    print_header()

    run()
Exemple #28
0
def main():
    load_dotenv()
    print("Running program")
    mongo_setup.global_init()

    fetch_alcohols()
Exemple #29
0
def main():
    mongo_setup.global_init()
Exemple #30
0
def main():
    mongo_setup.global_init('pypi')
    print_header()
    input_loop()
def main():
    mongo_setup.global_init()

    add_fake_data()
    do_some_queries()