Пример #1
0
def command():
    user_input = input("\n>>> ")
    command_list = user_input.split()

    action = command_list[0]

    if len(command_list) == 3:
        company_name = command_list[1]
        country = command_list[2]

        if action == 'add':
            add_company(company_name, country)
        elif action == 'rm':
            delete_company(company_name, country)
        elif action == 'update':
            update_company(company_name, country)
        elif action == 'check':
            check_company(company_name, country)
        else:
            print(f'Command {action} is not a valid action.')

    elif len(command_list) == 1:
        if action == 'list':
            Company.list_all()
        elif action == 'exit':
            exit(0)
        elif action == 'clear':
            if platform.system() == 'Linux' or platform.system() == 'Darwin':
                os.system('clear')
            else:
                os.system('cls')
        elif action == 'help':
            print_commands()
        else:
            print(f'Command *{action}* is not a valid action.')
Пример #2
0
def updateprofile():
    checkcompanyvalidlogin()
    obj_company=Company()
    #obj_student.getstudentbasicdetails("*****@*****.**",db)
    print "update profile",session.emailid
    obj_company.getcompanybasicdetails(session.emailid,db)
    return dict(companydetails=obj_company)
Пример #3
0
def extract_stock_data(directory):
    '''
        Figure out array size.

            Let's make a list of lists.

            Initial list - It would have file_count number of rows corresponding to each company
            Every element in the list would contain a list of objects of yype dailyData
    '''

    path, dirs, files = os.walk(directory).__next__()
    file_count = len(files)

    companyStockList = []
    companyList = []
    companyIndex = 0

    for filename in os.listdir(directory):

        if filename.endswith(".txt"):

            dataList = []
            f = open(directory + "/" + filename)
            lines = f.read()

            lines = lines.splitlines()

            if (len(lines) == 0):
                continue

            company = Company(filename, companyIndex, "", "", "", "")
            companyIndex += 1

            header = lines[0]

            end = 1001
            if (end > len(lines)):
                end = len(lines)

            for i in range(1, end):

                currentLine = lines[i].split(",")

                if (i == 1):
                    company.start_date = currentLine[0]

                if (i == end - 1):
                    company.end_date = currentLine[0]

                curData = dailyData(currentLine[0], currentLine[1],
                                    currentLine[2], currentLine[3],
                                    currentLine[4], currentLine[5])
                dataList.append(curData)

            companyStockList.append(dataList)
            companyList.append(company)

        else:
            continue
    return companyList, companyStockList
def company_test(companies):
    t = Company(
        companies,
        output_root=
        r'C:\Users\zleirdahl\Desktop\PythonScripts\iex\Data\Companies\\',
        file_suffix='company')
    t.run()
Пример #5
0
def create_companies():
    companies = []
    companies += [Company(5)]
    companies += [Company(0)]
    companies += [Company(1)]
    companies += [Company(3)]
    return companies
def get_by_portfolio_id(portfolio_id, load_full=False):
    qry = """
        SELECT *
        FROM `stocks`.`portfolio_events`
        WHERE
            `portfolio_id` = %s;
    """ % portfolio_id
    rows = db.ex(qry)
    if len(rows) <= 0:
        return None
    events = []
    company_ids = []
    for row in rows:
        pe = PortfolioEvent().build_from_row(row)
        events.append(pe)
        if pe.company_id not in company_ids:
            company_ids.append(pe.company_id)
    companies = {}
    for c in company_ids:
        company = Company().get_company_by_id(c)
        company.stake = 0
        company.value = 0
        companies[company.id] = company
    portfolio = {
        'events': events,
    }
    if not load_full:
        return portfolio
    totals = {
        'amt_invested': 0,
        'cash_in': current_cash_in,
        'amt_total_value': 0,
        'amt_standing': 0,
        'percent_val': 0
    }
    company_ids = set()
    for e in events:
        e.company = companies[e.company_id]
        company_ids.add(e.company_id)
        if e.type == 'buy':
            totals['amt_invested'] += (e.price * e.count)
            totals['amt_total_value'] += (e.company.price * e.count)
            e.company.stake += (e.price * e.count)
            e.company.value += (e.company.price * e.count)
    totals['cash_available'] = float(totals['cash_in']) - float(totals['amt_invested'])
    totals['amt_standing'] = totals['amt_invested'] - totals['amt_total_value']
    totals['percent_val'] = common.get_percentage(
        totals['amt_standing'],
        totals['amt_invested'])
    quotes = quote_collections.get_by_company_ids(company_ids)
    print quotes
    portfolio = {
        'companies': companies,
        'events': events,
        'totals': totals
    }
    return portfolio
Пример #7
0
def saveprofile():
    checkcompanyvalidlogin()
    obj_company=Company()
    #obj_student.getstudentbasicdetails("*****@*****.**",db)
    obj_company.createbasiccompany(request.vars)
    print session.emailid
    obj_company.updatecompany(session.emailid,db)
    redirect(URL('company','home'))
    return dict()
Пример #8
0
 def __init__(self, name, train_start_date_string,
              train_end_test_start_date_string, test_end_date_string):
     Company.__init__(self, name)
     self.train_raw_series = self.get_share_prices(
         train_start_date_string, train_end_test_start_date_string)
     self.test_raw_series = self.get_share_prices(
         train_end_test_start_date_string,
         test_end_date_string,
         start_delay=1)
Пример #9
0
def main():
    print('1 - Add Employee')
    print('2 - Add Boss')
    print('3 - Print employees')
    print('4 - Remove employee by index')
    print('5 - Save company to file')
    print('6 - Read company to file')
    print('7 - Exit')

    company = Company()
    while True:
        command = input('Enter command: ')
        if command == '1':
            emp = Employee()
            company.add_employee(emp.read_from_console())
        elif command == '2':
            boss = Boss()
            company.add_employee(boss.read_from_console())
        elif command == '3':
            print(company)
        elif command == '4':
            index = int(input('Enter index: '))
            del company.employees[index]
        elif command == '5':
            fname = input('Enter file name: ')
            company.write_to_file(fname)
        elif command == '6':
            fname = input('Enter file name: ')
            company = Company.read_from_file(fname)
        elif command == '7':
            break
        else:
            print('Wrong command!')
Пример #10
0
def update_company(company_name, country):
    comp = Company(company_name, country)
    exist = comp.check_without_print()
    if exist:
        new_name = input('New name (Leave blank if old name): ')
        new_country = input('New country (Leave blank if old name): ')

        comp.update(new_name, new_country)
        print('DONE')
    else:
        print(f'Company {company_name} from {country} doesnt exist.')
Пример #11
0
def read_companys(filename=file_name):
    with open(filename, 'r',encoding='gb18030') as csvfile:
        reader = csv.reader(csvfile)
        list = []
        for row in reader:
            stock = row[0]
            name = row[1]
            comp = Company(stock)
            comp.name = name
            list.append(comp) #第一个元素
        return list
Пример #12
0
    def run(self):

        for num in self.stock:
            comp = Company(num)
            news = scraper.scrap_news_company(comp)
            comp.news = news
            comp.rate = scraper.analysis_news(news)
            self.result_list.append(comp)
            timecounter.updateprogress()
        #完成线程,回调
        if self.callback:

            self.callback(self.result_list)
Пример #13
0
def check_events(color, events, units, screen, flags, cprof):
    """ watch keyboard/mouse for events

    When close window button is pressed, exit the game. Other functionality
    may come later.
    """
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit()
        if event.type == pygame.KEYDOWN:
            if event.unicode == "q":
                color = "blue"
            if event.unicode == "e":
                color = "green"
            if event.unicode == "z":
                if color == "blue":
                    units.append(
                        Company(screen, 0, *pygame.mouse.get_pos(), 2, 2,
                                color, flags, 500))
                if color == "green":
                    units.append(
                        Company(screen, 0, *pygame.mouse.get_pos(), 2, 2,
                                color, flags, 500, False))
            if event.unicode == "x":
                if color == "blue":
                    units.append(
                        Battery(screen, 0, *pygame.mouse.get_pos(), 3, color,
                                flags, 12))
                if color == "green":
                    units.append(
                        Battery(screen, 0, *pygame.mouse.get_pos(), 3, color,
                                flags, 12, False))
            if event.unicode == "c":
                if color == "blue":
                    units.append(
                        Squadron(screen, 0, *pygame.mouse.get_pos(), 2, 2,
                                 color, flags, 120))
                if color == "green":
                    units.append(
                        Squadron(screen, 0, *pygame.mouse.get_pos(), 2, 2,
                                 color, flags, 120, False))
            if event.unicode == "f":
                units = []
                flags = []
            if event.unicode == "g":
                cprof.print_stats('tottime')
    for event in events:
        units = event.check(units)
        if event.triggered:
            events.remove(event)
    return color, units
Пример #14
0
def register():
  if request.method == "GET": 
    return render_template("registercompany.html") 
  if request.method == "POST":
    form = request.form
    title = form['title']
    add = form['address']
    industry = form['industries']
    # if title in Company.title():
    #   return "This company has been register"
    # else:
    p = Company(title=title, address=add, industries=industry)
    p.save()
    return "Thank you for register your company"
Пример #15
0
def main():
    get_all_companies()
    print("\nIrish Stock Exchange share price viewer\n")
    print_company_list()
    print()
    company.instructions()

    while True:

        invalid_input = True
        print(">>")
        user_input = sys.stdin.readline()

        if user_input < "56" and user_input > "0":
            valid_date = False
            while valid_date == False:
                print("Enter a start date (DD/MM/YYYY)")
                start_date_string = sys.stdin.readline()
                print("Enter an end date (DD/MM/YYYY)")
                end_date_string = sys.stdin.readline()
                valid_date = company.check_valid_date(start_date_string,
                                                      end_date_string)

            start_day = start_date_string.split('/')[0].lstrip('0')
            start_month = start_date_string.split('/')[1].lstrip('0')
            start_year = start_date_string.split('/')[2].lstrip('0')

            end_day = end_date_string.split('/')[0].lstrip('0')
            end_month = end_date_string.split('/')[1].lstrip('0')
            end_year = end_date_string.split('/')[2].lstrip('0')

            print("Retrieving data for " +
                  companies_list[int(user_input)].name + " for dates " +
                  start_date_string + " - " + end_date_string)

            Company.date_crawler(int(user_input),
                                 (start_day, start_month, start_year),
                                 (end_day, end_month, end_year),
                                 companies_list)
            invalid_input = False
        elif "<ALL>" in user_input:
            company.crawler(-1)
            invalid_input = False
        elif "<COMPANIES>" in user_input:
            print_company_list()
            invalid_input = False
        elif invalid_input:
            print("\nInvalid Input...")
            company.instructions()
Пример #16
0
def add_hex_to_dic(input_dic, line, current_file):
    splitted_line = line.split(g_hex_splitter)
    mac = re.sub('\s+', ' ', splitted_line[0])
    comp = re.sub('\s+', ' ', splitted_line[1])
    if comp not in input_dic:
        input_dic[comp] = Company(comp)

    if current_file not in input_dic[comp].files:
        input_dic[comp].files.append(current_file)
        if input_dic[comp].first_entry:
            input_dic[comp].files_cnt.append(input_dic[comp].files_cnt_tmp)
            input_dic[comp].files_cnt_tmp = 0
    input_dic[comp].first_entry = 1
    input_dic[comp].files_cnt_tmp += 1
    input_dic[comp].add_hex_mac(mac)
Пример #17
0
def load_companies(args: TrendArgs) -> List[Company]:
    args.load_model = True
    args.load_from_yahoo = False
    df = pd.read_csv("dataset/companies.csv")
    companies_name = df['0'].to_list()
    companies = []

    for i, name in enumerate(companies_name):
        try:
            company = Company(name, args)
            company.load_data()
            companies += [company]
        except FileNotFoundError:
            pass
    return companies
 def assign_colors_to_managers(cls):
     colors = []
     for i, j in enumerate(cls.get_manager_names_and_companies()):
         for k in Company.get_companies():
             if j[1] == k.name:
                 colors.append(k.avg_color)
     return colors
 def createCompany(self, time, companyId):
     """Creates a new company belonging to the businessman who founds it."""
     company = Company(companyId)
     self.companies.append(company)
     logger.log_createCompany(time, self, company)
     logger.testLog(time)
     return company
Пример #20
0
def get_all_companies():
    page = 1
    company_index = 1

    while page <= 2:
        url = "http://www.ise.ie/Market-Data-Announcements/Companies/Company-data/"

        if page == 2:
            url = url + "?ACTIVEGROUP=2&&type=CHANGEPRICE"  # page 2

        source_code = requests.get(url)  # get the page source
        plain_text = source_code.text

        soup = BeautifulSoup(plain_text,
                             "html.parser")  # BS object with html parser

        i = 0
        for table_row in soup.find_all(
                'td', 'equityName mDataGrid480'):  # class of each company name
            if (
                    i % 2
            ) == 0:  # every second one is "INSTRUMENT NAME" column on the web page, I dont want that...
                for link in table_row.find_all('a'):

                    company = Company(
                        link.string, ROOT_URL + link.get('href'),
                        company_index)  # create new company object
                    companies_list[company_index] = company
                    company_index = company_index + 1

            i = i + 1
        page = page + 1
Пример #21
0
def main():
    # get a number from the user
    n = ''
    while not n.isdigit():
        n = input('which user would you like to access?')
        # if int(n)>10:
        #     n=''
    urlStub = 'https://jsonplaceholder.typicode.com/users/'
    try:
        res = requests.get(urlStub + n)
    except HTTPError as http_err:
        print(f'HTTP error occurred: {http_err}')  # Python 3.6
    except Exception as err:
        print(f'Other error occurred: {err}')  # Python 3.6
    else:
        userDict = res.json()
        # print(userDict['company']['name']) # check we have some data
        # populate instances of Company, Address and User
        co_name = userDict['company']['name']
        co_catch = userDict['company']['catchPhrase']
        co_bs = userDict['company']['bs']
        user_co = Company(name=co_name, catchPhrase=co_catch, bs=co_bs)

        add_street = userDict['address']['street']
        add_city = userDict['address']['city']
        add_zip = userDict['address']['zipcode']
        user_address = Address(street=add_street,
                               city=add_city,
                               zipcode=add_zip)

        user = User(id=userDict['id'],
                    name=userDict['name'],
                    address=user_address,
                    company=user_co)
        print(user)
Пример #22
0
    def __init__(self, count=4):
        self.companies = []
        for _ in range(count):
            self.companies.append(Company())

        template_file = Path('html/index.template.html')
        self.template = Template(template_file.read_text('utf8'))
Пример #23
0
def make_invoice(json_object):    
    buyer, seller = [Company(party, **json_object.pop(party)) \
                         for party in ['buyer', 'seller']]    
    terms = Terms(**json_object.pop('terms'))
    items = ItemCollection(json_object.pop('items'))
    invoice = Invoice(buyer, seller, items, terms, **json_object)
    return invoice.html()
Пример #24
0
def main(company_name):
    # Ajustando o seletor de campos de retorno
    selectors = [
        'entityStatus', 'vanityName', 'id', 'industries', 'foundedOn',
        'website', 'specialties', 'staffCountRange'
    ]
    extracted_data = []

    for comp in company_list:
        # chamando a função para efetuar a consulta das empresas er colocando o resultado em uma lista
        extracted_data.append(
            Company.search_company_by_vanityName(vanityName=comp,
                                                 selectors=selectors))

        if extracted_data:
            print('')
            print('ERRO: conteúdo retornado vazio -->>', extracted_data)
        else:
            print('')
            print('Resultado da requisição em tela da empresa', comp,
                  extracted_data)
            print('')
            # Coletando o "datetime" do momento da geração do arquivo para montar o nome do arquivo distinto por coleta
            filename = comp + '_' + time.strftime("%Y%m%d-%H%M%S") + '.json'
            print(
                'Exportando resultado da requisição para o seguinte arquivo JSON:',
                filename)
            f = open(filename, 'w')
            json.dump(extracted_data, f, indent=4)
            print('Exportação finalizada com sucesso!')
Пример #25
0
def add_base_to_dic(input_dic, line):
    splitted_line = line.split(g_base_splitter)
    mac = re.sub('\s+', ' ', splitted_line[0])
    comp = re.sub('\s+', ' ', splitted_line[1])
    if comp not in input_dic:
        input_dic[comp] = Company(comp)
    input_dic[comp].add_base_mac(mac)
Пример #26
0
 def create_competitors_insert(self, database, company):
     """
     get database instance and company and insert the competitors to DB & update competitors table
     :param database:
     :param company:
     :return:
     """
     if company.get_company_competitors() is not None:
         for competitor_name in company.get_company_competitors():
             competitor_name = competitor_name.strip()
             if competitor_name.lower().split(' ')[int(self.config['Constant']['LAST_ELEMENT'])] \
                     in self.config['Constant']['CORPORATION']:
                 competitor_name = ' '.join(competitor_name.lower().split(' ')[:int(self.config['Constant']
                                                                                    ['LAST_ELEMENT'])])
             if not database.get_company(competitor_name):  # we don't have the competitor in DB
                 competitor = Company(competitor_name, None)
                 competitor_scraping = CompanyPageScraper(self.geckodriver_path, competitor_name)
                 competitor_scraping.set_search_keywords()
                 competitor = competitor_scraping.enter_company_page(competitor)
                 competitor.set_company_sector(company.get_company_sector())
                 database.insert_company(competitor)
                 if competitor.get_company_sector():
                     database.insert_company_sector(competitor)
                 if competitor.get_company_type():
                     database.insert_company_type(competitor)
                 if competitor.get_company_industry():
                     database.insert_company_industry(competitor)
             database.insert_competitor(competitor_name, company)
Пример #27
0
    def add_employee_to_location(self, location):
        add_to_new_company = False
        # TODO Add criteria when new Company is created
        pass
        # if compares to == 1 not to == 0 to ignore the first company which
        # provides public charging for a location
        if len(location.companies) == 1:
            add_to_new_company = True

        company = Company()
        if add_to_new_company:
            company = self.add_company(location)
        else:
            company = random.choice(list(location.companies.values())[1:])

        company.add_employee()

        return company
Пример #28
0
def get_data_load_file(data_json="data.json"):
    company_list = []
    company_json_list = []

    if os.path.isfile(data_json):
        try:
            with open(data_json, 'r', encoding="utf-8") as f:
                company_json_list = json.load(f)
        except:
            print("[-]: Load cat json failed!")
            os.remove(data_json)

    for company in company_json_list:
        company_class = Company()
        company_class.set_data(company)
        company_list.append(company_class)

    return company_list
Пример #29
0
def addCompany(companies):
    id = input("Please, input the company id: ")
    if companies.exists(id):
        print "This id already exists"
        return False
    name = raw_input("Please, input the company name: ")
    country = raw_input("Please, input the company country: ")
    new_company = Company(id, name, country)
    return companies.add(new_company)
Пример #30
0
def generate_keyvalues_forlist(delete_previous, generate_keyvalues):
    if delete_previous:
        clear_folder()
        delete_folder()

    if generate_keyvalues:
        for name in namelist:
            companylist.append(Company(name))
        for element in companylist:
            element.generate_keyvalues()
Пример #31
0
    def overall_gains1(self, start1, end1):
        total = 0

        x = Company('GOOG')
        today_date = x.dates[len(x.dates) - 1]
        start = x.dates.index(start1)
        end = x.dates.index(end1)
        for i in range(start, end + 1):
            total += self.gains(x.dates[i], end1)
        return total
Пример #32
0
def from_cik_to_company(cik_file="cik.xlsx",
                        first_company=1,
                        last_company=100,
                        verbose=True,
                        log="from_cik_to_company_log.txt"):
    cik_sheet = xlrd.open_workbook(cik_file).sheet_by_index(0)
    companies = []
    cik_filter = {}
    log_file = None
    if verbose and not (log is None):
        log_file = open(log, "w", errors="ignore")

    estimate_total = min(last_company - first_company + 1,
                         cik_sheet.nrows * cik_sheet.ncols)
    company_cnt = 0
    for i in range(0, cik_sheet.nrows):
        for j in range(0, cik_sheet.ncols):
            if str(cik_sheet.cell_value(i, j)).strip() == "":
                continue
            try:
                cik = str(int(cik_sheet.cell_value(i, j))).strip()
            except ValueError:
                mess = "{} is not a valid CIK".format(
                    cik_sheet.cell_value(i, j))
                print_log(mess, log_file, verbose)
                continue

            while len(cik) < 10:
                cik = "0" + cik
            if cik in cik_filter:
                continue
            cik_filter[cik] = {}

            company_cnt += 1
            if not (first_company <= company_cnt <= last_company):
                continue

            try:
                company_name = edg.get_company_name_by_cik(cik)
            except KeyError:
                mess = "{} is not a valid CIK".format(cik)
                print_log(mess, log_file, verbose)
                continue

            companies.append(Company(company_name, cik))
            mess = "#={}/{}, cik={}, company_name={}".format(
                len(companies), estimate_total, cik, company_name)
            print_log(mess, log_file, verbose)

    mess = "{} companies found".format(len(companies))
    print_log(mess, log_file, verbose)
    if log_file is not None:
        log_file.close()

    return companies
Пример #33
0
def day_of_neuedu(company: Company):
    global index
    if index % 7 == 0:
        student_num = len(company.income_money)
        total_income = sum(map(lambda x: x.income, company.income_money))

        print('-' * 30 + f'周末休息' + '-' * 30)
        print(
            f'\033[1;35m截止目前共有{student_num}名学员来到东软睿道学习,公司总营收收入{total_income}元\033'
        )
        print('-' * 30 + f'周末休息' + '-' * 30)
        time.sleep(3)

    print('-' * 30 + f'东软睿道美好的一天开始了,各部门员工紧张忙碌了起来' + '-' * 30)

    print('市场部开始接待客户')
    student = company.get_student()
    if student:
        company.add_money(student)
        company.add_student_to_noclasslist(student)

    print(f'当前有{len(company.classes)}个班级在上课')

    class_removed = []

    if len(company.classes) > 0:
        print('实施部的大咖们开始给学员上课了')

    for c in company.classes:
        is_closed = c.stand_up()
        for student in c.students:
            student.study()
        if is_closed:
            class_removed.append(c)

    for c_del in class_removed:
        print(f'{c_del.class_name}学生毕业了,全部找到高薪工作,迎娶白富美,走上人生巅峰')
        company.classes.remove(c_del)

    global timer
    timer = threading.Timer(1, day_of_neuedu, [company])
    timer.start()
Пример #34
0
    def add_company(self, location):
        uid = len(self.companies)

        if len(self.electricity_plan_manager.commercial_plan_uids) == 0:
            sys.exit("CompanyManager: No commercial electricity plans to"\
                     + "to choose from")
        # TODO Add criteria based on which electricity plan is chosen
        electricity_plan_uid \
            = random.choice(self.electricity_plan_manager.commercial_plan_uids)
        electricity_plan \
            = self.electricity_plan_manager.electricity_plans[electricity_plan_uid]

        # TODO Add criteria for charger cost
        charger_cost_per_kWh, employees_per_charger = 0, 0
        if len(location.companies) == 0:  # if company provides public charging
            charger_cost_per_kWh \
                = self.parameters.get_parameter("public_charger_cost_per_kWh",
                                                "float")
            employees_per_charger = 1
        else:  # if company provides charging for employees
            charger_cost_per_kWh \
                = self.parameters.get_parameter("company_charger_cost_per_kWh",
                                                "float")
            employees_per_charger \
                = self.parameters.get_parameter("employees_per_charger",
                                                    "positive_int")

        if len(self.charger_manager.charger_models) == 0:
            sys.exit("CompanyManager: No charger models to to choose from")

        # TODO Add criteria based on which the charger model is chosen
        charger_model_uid \
            = random.choice(self.charger_manager.commercial_model_uids)
        charger_model \
            = self.charger_manager.charger_models[charger_model_uid]

        # TODO Add criteria to choose this ratio
        employees_per_charger \
            = self.parameters.get_parameter("employees_per_charger",
                                            "positive_int")

        company = Company(uid, self.clock, location, electricity_plan,
                          self.charger_manager, charger_cost_per_kWh,
                          charger_model, employees_per_charger)
        self.companies.append(company)
        location.companies[company.uid] = company

        # add chargers to public charging company
        number_of_public_chargers \
            = self.parameters.get_parameter("number_of_public_chargers", "int")
        for i in range(number_of_public_chargers):
            company.ccm.add_charger()

        return company
Пример #35
0
def get_qualified_company(company_name, year_filter, category_filter):
    """Search CrunchBase for the company name and fundraising rounds, but only
    return companies whose fundraising rounds fit the year and category
    restrictions."""
    search_results = search_crunchbase(company_name)

    qualified_company = None
    # If search returned results and the first result is a company.
    if search_results and search_results[0].get(CB.NAMESPACE) == CB.COMPANY:
        search_result_dict = search_results[0]
        permalink = search_result_dict.get(CB.PERMALINK)

        # Use the permalink to get a more valuable Company object.
        company_dict = lookup_company_by_permalink(permalink)
        if company_dict:
            company = Company(company_dict)

            if company.get_qualified_rounds(year_filter, category_filter):
                qualified_company = company

    return qualified_company
 def choose():
     option = input("Please enter the key of the option, that you want to choose: ")
     if option == "1":
         companies = Company.get_all()
         tagcloud = CompanyTagCloudGen(companies)
         tagcloud.display()
     elif option == "2":
         projects = Project.get_all()
         tagcloud = ProjectTagCloudGen(projects)
         tagcloud.display()
         # TagCloudGen.display(projects)
     elif option == "3":
         hqs = Hq.get_all()
         tagcloud = HqTagCloudGen(hqs)
         tagcloud.display()
     elif option == "q":
         exit()
     else:
         raise KeyError("There is no such option.")
Пример #37
0
from jobseeker import JobSeeker
from loc import Location 
from cat import Cat
from company import Company
from history import History

for l in [ 'Delhi', 'Bangalore', 'Mumbai', 'Pune', 'Hyderabad' ]:
	loc = Location(l)
	loc.save()

for c in [ 'IT/Hardware', 'IT/Software', 'Sales', 'Marketing', 'Finance', 'Management', 'ITES' ]:
	cat = Cat(c)
	cat.save()

for c in [ 'ABC', 'XYZ' ]:
	co = Company(c)
	co.save()

r = Rec(fname='Ashish',lname='Mukherjee',password='******',email='*****@*****.**', cpny_id = 1)
r.save()

j = Job(job_code = 'SSE - 1000',loc_id=1,title = 'Senior Software Engineer - Java',descr = 'Seeking mid-level Java programmer',kw = 'java',rec_id = 1,cat_id = 1,cpny_id = 1)
j.save()

j = JobSeeker(fname = 'Ashish', lname = 'Mukherjee', email = '*****@*****.**', phone = '8800199033', title = 'Experienced Java Engineer', resume = 'AshishMukherjee.doc', loc_id = 1, cat_id = 1, kw = 'Java', vdo = '')
j.save()

h = History(job_id = 1, rec_id = 1, cand_id = 1, comments = 'Nice resume', stage = 'WIP')
h.save()

j = Job.get_object(1)
Пример #38
0
def home():
    checkcompanyvalidlogin()
    obj_comapny=Company()
    #obj_student.getstudentbasicdetails("*****@*****.**",db)
    obj_comapny.getcompanybasicdetails(session.emailid,db)
    return dict(companydetails=obj_comapny)
Пример #39
0
def new_registration():
    obj=Company()
    obj.createbasiccompany(request.vars)
    obj.insertcompany(db)
    return dict()
            #     return 11 * self.weight, self.text_size[0]
        else:
            raise Exception('No text_size parameters')

class Cloud():

    def __init__(self, max_width, max_height, color):
        self.max_width = max_width * 2
        self.max_height = max_height
        self.color = color

    def create_cloud(self):
        img = Image.new("RGB", (self.max_width, self.max_height), self.color)
        return img

world_tuple = Company.get_companies()
text_size = 0
picture = 0
text_list = []

for world in world_tuple:
    worlds = Text(world.name, world.weight, world.avg_color)
    text_list.append(worlds)  # worlds,
    w, h = worlds.get_text_size()
    text_size += w*h

cloud = Cloud(math.ceil(math.sqrt(text_size))*2, math.ceil(math.sqrt(text_size)), (120, 120, 120))
# img = Image.new("RGB", (math.ceil(math.sqrt(text_size))*2, math.ceil(math.sqrt(text_size))), (120, 120, 120))
img = cloud.create_cloud()
draw = ImageDraw.Draw(img)
MAX_HEIGHT = cloud.max_height  # math.ceil(math.sqrt(text_size))
    def menu(cls):

        cls.input_ceck()

        tag_cloud_1 = """(1) Generates tag cloud that shows the company names:
        - font size based on number of projects (the more, the bigger)
        - font color are a mixture of their project colors"""
        tag_cloud_2 = """(2) Generates tag cloud that shows the project names:
        - font size based on the budget of the project (the more, the bigger)
        - font color based on the project colors"""
        tag_cloud_3 = """(3) Generates tag cloud that shows the project names:
        - font size based on the due date of the project (the older, the smaller)
        - font color based on whether the project requires maintenance or not"""
        tag_cloud_4 = """(4) Generates tag cloud that shows the names of the manager:
        - font size based on the budget of the project (the older, the smaller)
        - font color is based on the company they work for"""

        for i in range(1, 5):
            print("(%d) Generate tag cloud. Type 'info %d' for more information." % (i, i))


        user_input = input("").lower()
        while True:
            if user_input == "info 1":
                print(tag_cloud_1)
                user_input = input("").lower()
            if user_input == "info 2":
                print(tag_cloud_2)
                user_input = input("").lower()
            if user_input == "info 3":
                print(tag_cloud_3)
                user_input = input("").lower()
            if user_input == "info 4":
                print(tag_cloud_4)
                user_input = input("").lower()
            if user_input == "1":
                cls.database = Company.get_companies()
                cls.multiplicator_height = 1.5
                cls.multiplicator_width = 2.7
                cls.image = "image.jpg"
                break
            if user_input == "2":
                cls.database = Image2.get_image2()
                cls.multiplicator_height = 1.5
                cls.multiplicator_width = 3
                cls.image = "image7.jpg"
                break
            if user_input == "3":
                cls.database = Image3.get_image3()
                cls.multiplicator_height = 1.8
                cls.multiplicator_width = 3.4
                cls.image = "image6.jpg"
                break
            if user_input == "4":
                cls.database = Manager.get_all()
                cls.multiplicator_height = 1.5
                cls.multiplicator_width = 3
                cls.image = "image.jpg"
                break
            else:
                print("Unavailable, please try again.")