diff --git a/DataCollection/app.py b/DataCollection/app.py index 50c6e02..41d10af 100644 --- a/DataCollection/app.py +++ b/DataCollection/app.py @@ -19,17 +19,17 @@ allowed_experience_levels = ['Entry', '', 'Staff', 'Senior', 'Lead', 'Principal'] def validate_job_data(data): - if not all(field in data for field in expected_data): + if any(field not in data for field in expected_data): return False, 'Invalid data format' - + if data['Employment Type'] not in allowed_employment_types: return False, 'Invalid Employment Type' - + if data['Experience Level'] not in allowed_experience_levels: return False, 'Invalid Experience Level' - + #TODO: Add more checks like insurance it's within users country!!! - + return True, '' #TODO: REMEMBER IT'S NOT A DB!! So create a method that adds things together if `Industry=Employment Type= Location=Experience Level` diff --git a/DataCollection/signature_helper.py b/DataCollection/signature_helper.py index 4807989..8f5f28d 100644 --- a/DataCollection/signature_helper.py +++ b/DataCollection/signature_helper.py @@ -10,16 +10,12 @@ def sign_data(data, private_key_path): password=None, backend=default_backend() ) - - # Create a signature - signature = private_key.sign( + + return private_key.sign( data, padding.PSS( mgf=padding.MGF1(hashes.SHA256()), - salt_length=padding.PSS.MAX_LENGTH + salt_length=padding.PSS.MAX_LENGTH, ), - hashes.SHA256() - ) - - # return signature.hex() #used this when I didn't have any default_backend code!!! - return signature \ No newline at end of file + hashes.SHA256(), + ) \ No newline at end of file diff --git a/Legit/CompanyOpeningsAndApplications.py b/Legit/CompanyOpeningsAndApplications.py index a564b5a..647142a 100644 --- a/Legit/CompanyOpeningsAndApplications.py +++ b/Legit/CompanyOpeningsAndApplications.py @@ -203,7 +203,7 @@ def company_workflow(self, incoming_link): link = self.list_of_links[index] if self.companys_every_job_detail: self.fetch_matching_current_jobs_details(link) - + # if self.current_url != link: if self.check_if_webpage_changed(): print("DIDN'T WORK!!!!") @@ -211,11 +211,9 @@ def company_workflow(self, incoming_link): else: print("Should only skip the 1st index as that will be the only current_url value that we assign to current_value prior to an iteration in this for loop") pass - + print(f"The current url is {self.current_url}") - - #TODO: refactor this! - #! FAILS: If "Internal-Job-Listings" is the initial webpage this ruins + if not self.companys_internal_job_openings_URL: self.try_finding_internal_job_openings_URL() #link !!!!!!! webpage_num = 0 @@ -224,17 +222,15 @@ def company_workflow(self, incoming_link): self.check_companies_other_job_openings(link) if initial_link_processed_internal_job_listings: webpage_num = og_webpage_num + elif len(self.list_of_links) == 1 and link == self.companys_internal_job_openings_URL: + print("The initial link was self.companys_internal_job_openings_URL and no jobs were found so skip this crummy company!") + #continue + pass else: # NEW NEW NEW NEW - if len(self.list_of_links) == 1 and link == self.companys_internal_job_openings_URL: - print("The initial link was self.companys_internal_job_openings_URL and no jobs were found so skip this crummy company!") - #continue - pass - else: - # NEW NEW NEW NEW - webpage_num = 1 + webpage_num = 1 print(f"\nwebpage_num = {webpage_num}") - + #TODO: FIGURE THIS FLOW OUT!!!! self.reset_webpages_soup_elements() if self.job_application_webpage[webpage_num] == "Job-Description": @@ -251,8 +247,8 @@ def company_workflow(self, incoming_link): print(" >If determine_current_page() returns 2 it cant be accessed and the while will just skip to the next link!<") self.reset_every_job_variable() webpage_num = 1 - - print(f"WHILE WHILE\n self.list_of_links = {self.list_of_links}\n") + + print(f"WHILE WHILE\n self.list_of_links = {self.list_of_links}\n") index += 1 return print("--------------------------------------------\nTransferring power to JobSearchWorkflow") @@ -439,15 +435,7 @@ def check_language_of_webpage(self): text = soup.get_text() model = fasttext.load_model('lid.176.bin') predictions = model.predict(text) - language_of_webpage = predictions[0][0].replace('__label__', '') - #TODO: Determine whether this should go here or somewhere else!! - # if language_of_webpage == 'en': - # return True - # else: - # return False - # = = = = - # return language_of_webpage == 'en' - return language_of_webpage + return predictions[0][0].replace('__label__', '') #!============================================== #??????????? FIX @@ -471,8 +459,8 @@ def url_parser(self, url): parts = urlparse(url) directories = parts.path.strip('/').split('/') queries = parts.query.strip('&').split('&') - - elements = { + + return { 'scheme': parts.scheme, 'netloc': parts.netloc, 'path': parts.path, @@ -482,20 +470,15 @@ def url_parser(self, url): 'directories': directories, 'queries': queries, } - - return elements def recognized_pattern_based_url(self, link): print(f"\nrecognized_pattern_based_url()") elements = self.url_parser(link) - + # Keep only the first segment of the path new_path = elements['directories'][0] if elements['directories'] else '' - - # Reconstruct the URL with the new path - new_url = f"{elements['scheme']}://{elements['netloc']}/{new_path}" - return new_url + return f"{elements['scheme']}://{elements['netloc']}/{new_path}" def try_finding_internal_job_openings_URL(self): print("\ntry_finding_internal_job_openings_URL()") @@ -543,8 +526,7 @@ def hard_coded_link_extraction(self, url): if not self.companys_internal_job_openings_URL: try: self.soup_elements['webpage_body'] = self.soup_elements['soup'].find('body') - links_in_header = [] - links_in_header.append(webpage_currently) + links_in_header = [webpage_currently] webpage_header = self.soup_elements['webpage_body'].find('div', {"class": 'main-header-content'}) company_open_positions_a = webpage_header.find('a', {"class": "main-header-logo"}) try: @@ -565,10 +547,10 @@ def hard_coded_link_extraction(self, url): self.soup_elements['div_main'] = self.soup_elements['soup'].find("div", id="main") self.soup_elements['header'] = self.soup_elements['soup'].find('header') self.soup_elements['app_body'] = self.soup_elements['div_main'].find('div', id=lambda x: x in ["app-body", "app_body"]) - + except: raise ConnectionError("ERROR: Companies other open positions are not present") - + a_fragment_identifier = None company_other_openings_href = None first_child = True @@ -587,12 +569,12 @@ def hard_coded_link_extraction(self, url): company_other_openings_href = head_a_tag elif '#' in head_a_tag['href']: a_fragment_identifier = head_a_tag - elif head_a_tag == None: + elif head_a_tag is None: logo_container = self.soup_elements['app_body'].find('div', class_="logo-container") company_openings_a = logo_container.find('a') company_other_openings_href = company_openings_a['href'] searched_all_a = True - if company_other_openings_href == None: + if company_other_openings_href is None: self.print_companies_internal_job_opening("greenhouse_io_banner()", "greenhouse", JobHREF="Couldnt Find", LinkToApplication_OnPageID=a_fragment_identifier) else: self.print_companies_internal_job_opening("greenhouse_io_banner()", "greenhouse", JobHREF=company_other_openings_href, LinkToApplication_OnPageID=a_fragment_identifier) @@ -602,7 +584,7 @@ def check_banner_links(self, links_in_header): first_link = True #list_of_other_jobs_keyword = '' for header_link in links_in_header[:-1]: - if first_link == True and "lever" == self.application_company_name: + if first_link == True and self.application_company_name == "lever": self.try_adjusting_this_link(header_link) #list_of_other_jobs_keyword = 'list-page' first_link = False @@ -614,7 +596,7 @@ def check_banner_links(self, links_in_header): self.try_adjusting_this_link(header_link) #list_of_other_jobs_keyword = '' first_link == False - + #! Multithreading with concurrent.futures.ThreadPoolExecutor() as executor: #future_to_link = {executor.submit(self.check_link, header_link, list_of_other_jobs_keyword): header_link for header_link in links_in_header[:1]} @@ -628,8 +610,8 @@ def check_banner_links(self, links_in_header): return except Exception as exc: print(f'{link} generated an exception: {exc}') - - if (self.company_open_positions_link == None): + + if self.company_open_positions_link is None: #TODO: Make this a method links_in_header[-1].click() time.sleep(3) @@ -660,9 +642,9 @@ def process_links(self, possible_links): def construct_url_to_job(self, current_url, job_opening_href): print("\nconstruct_url_to_job()") - + print(f'current_url = {current_url}\njob_opening_href = {job_opening_href}') - + button_to_job_description = job_opening_href print(f'button_to_job_description = {button_to_job_description}') #True # job_link = job_opening_href.get('href') @@ -673,8 +655,7 @@ def construct_url_to_job(self, current_url, job_opening_href): # job_path = job_opening_href.get('href') job_path = job_opening_href print(f'job_path = {job_path}') - job_url = domain_name + job_path - return job_url + return domain_name + job_path def try_adjusting_this_link(self, adjust_this_link): print(f"\ntry_adjusting_this_link()") @@ -712,9 +693,7 @@ def test_links_if_internal_job_openings_URL(self, unique_possible_links): def check_if_internal_job_openings_URL(self, possible_link): print("\ncheck_link()") # Check if the link is the "Internal-Job-Listings" webpage - if self.determine_current_page(possible_link) == 0: - return True - return False + return self.determine_current_page(possible_link) == 0 #!============================================== @@ -752,10 +731,10 @@ def fits_users_criteria(self, test_elements_uniqueness, *args): ultimate_lists_checker = [] for arg in args: ultimate_lists_checker.extend(arg) - for unacceptable_element in ultimate_lists_checker: - if unacceptable_element in test_elements_uniqueness: - return False - return True + return all( + unacceptable_element not in test_elements_uniqueness + for unacceptable_element in ultimate_lists_checker + ) def users_basic_requirements_job_title(self, job_title): print("\nusers_basic_requirements_job_title()") @@ -785,20 +764,16 @@ def get_experience_level(self, job_title): def check_users_basic_requirements(self, job_title, job_location, job_workplaceType): print("\ncheck_users_basic_requirements()") - + print(f" self.current_jobs_details = {self.current_jobs_details}\n") print(f" job_title = {job_title}\n job_location = {job_location}\n job_workplaceType = {job_workplaceType}\n") print(f"self.users_job_search_requirements['entry_level'] = {self.users_job_search_requirements['entry_level']}") - + #if self.users_job_search_requirements['entry_level'] == True and self.users_basic_requirements_experience_level(job_title) == False: if self.users_job_search_requirements['entry_level'] == False or self.users_basic_requirements_experience_level(job_title) == True: return False location_and_workplaceType_check_out = self.user_basic_requirements_location_workplaceType(job_location, job_workplaceType) - if location_and_workplaceType_check_out == True: - pass - else: - return False - return True + return location_and_workplaceType_check_out == True def users_basic_requirements_experience_level(self, job_title): print("users_basic_requirements_experience_level()") @@ -823,36 +798,56 @@ def user_basic_requirements_location_workplaceType(self, job_location, job_workp # return False # if job_location not in self.users_job_search_requirements['user_preferred_locations']: # return False - - + + if self.users_job_search_requirements['user_preferred_locations'] and job_location not in self.users_job_search_requirements['user_preferred_locations']: return False - - + + if not job_workplaceType or job_workplaceType.lower() == "unknown": return False if job_workplaceType.lower() == 'in-office with occasional remote': - if 'in-office' in self.users_job_search_requirements['user_preferred_workplaceType'] or 'remote' in self.users_job_search_requirements['user_preferred_workplaceType']: - return True - else: - return False + return ( + 'in-office' + in self.users_job_search_requirements[ + 'user_preferred_workplaceType' + ] + or 'remote' + in self.users_job_search_requirements[ + 'user_preferred_workplaceType' + ] + ) if job_workplaceType.lower() == 'hybrid with rare in-office': - if 'hybrid' in self.users_job_search_requirements['user_preferred_workplaceType'] or 'remote' in self.users_job_search_requirements['user_preferred_workplaceType']: - return True - else: - return False + return ( + 'hybrid' + in self.users_job_search_requirements[ + 'user_preferred_workplaceType' + ] + or 'remote' + in self.users_job_search_requirements[ + 'user_preferred_workplaceType' + ] + ) if job_workplaceType.lower() == 'remote': return True if job_workplaceType.lower() == 'hybrid': - if 'hybrid' in self.users_job_search_requirements['user_preferred_workplaceType'] and 'in-office' in self.users_job_search_requirements['user_preferred_workplaceType']: - return True - else: - return False + return ( + 'hybrid' + in self.users_job_search_requirements[ + 'user_preferred_workplaceType' + ] + and 'in-office' + in self.users_job_search_requirements[ + 'user_preferred_workplaceType' + ] + ) if job_workplaceType.lower() == 'in-office': - if 'in-office' in self.users_job_search_requirements['user_preferred_workplaceType']: - return True - else: - return False + return ( + 'in-office' + in self.users_job_search_requirements[ + 'user_preferred_workplaceType' + ] + ) print("The dogs are acting strange") return False #!============================================== @@ -977,7 +972,7 @@ def print_matching_job_details(self, list_of_job_urls): for url in list_of_job_urls: # Check if the URL exists in self.current_jobs_details if url == self.current_jobs_details.get("job_url"): - print("**" + url + "**\n") # Print the matching URL + print(f"**{url}" + "**\n") # Print all the key-value pairs in the dictionary for key, value in self.current_jobs_details.items(): print(f"{key}: {value}") @@ -1007,10 +1002,9 @@ def collect_companies_current_job_openings(self, soup): self.soup_elements["postings_groups"] = self.soup_elements["postings_wrapper"].find_all('div', class_="postings-group") for postings_group in self.soup_elements["postings_groups"]: print(":-----------------------------------------------------------------------") - # Extracting large-category-header if present - #TODO - company_department[Design] - department = postings_group.find('div', class_="large-category-header") - if department: + if department := postings_group.find( + 'div', class_="large-category-header" + ): print("Large Category Header:", department.text) # Extracting posting-category-title if present #TODO - company_department[App-Design] @@ -1040,34 +1034,29 @@ def collect_companies_current_job_openings(self, soup): continue print(" Job PASSED!!") experience_level = self.get_experience_level(job_title) - + #TODO:----------------------------------------------------------------------- #Error Handling: Confirm apply_button and title_button links are = !!! apply_href = apply_button['href'] title_href = title_button['href'] - + absolute_apply_href, absolute_title_href = self.get_absolute_url(apply_href, title_href) - - if absolute_apply_href == absolute_title_href: - job_url = absolute_apply_href - else: - job_url = absolute_apply_href - #TODO:----------------------------------------------------------------------- - # Extracting other details - posting_categories = posting.find('div', class_="posting-categories") - if posting_categories: + job_url = absolute_apply_href + if posting_categories := posting.find( + 'div', class_="posting-categories" + ): job_location = posting_categories.find('span', class_='location').get_text().strip() if posting_categories.find('span', class_='location') else None company_department = posting_categories.find('span', class_='department').get_text().strip() if posting_categories.find('span', class_='department') else None employment_type = posting_categories.find('span', class_='commitment').get_text().strip() if posting_categories.find('span', class_='commitment') else None job_workplaceType = posting_categories.find('span', class_='workplaceTypes').get_text().strip() if posting_categories.find('span', class_='workplaceTypes') else None - + #*** self.print_job_details(job_url, job_title, job_location, company_department, employment_type, job_workplaceType, experience_level) #*** - - + + #if self.check_users_basic_requirements(job_title, job_location, job_workplaceType): michaels_secret_stuff = self.check_users_basic_requirements(job_title, job_location, job_workplaceType) if michaels_secret_stuff == True: @@ -1084,24 +1073,24 @@ def collect_companies_current_job_openings(self, soup): }) print("STEP 1:") print(f"experience_level = {experience_level}") - print(f"if not experience = ", end="") + print("if not experience = ", end="") print(not experience_level) if not experience_level: - - + + #! HERE TESTING HERE TESTING HERE TESTING HERE TESTING print("\nSTEP 2:") print("\nv v v v v v v v v v v v v v v v v v v ") print(f"self.current_jobs_details = {self.current_jobs_details}") print(f"job_url = {job_url}") print(f"list_of_job_urls = {list_of_job_urls}") - + list_of_job_urls.append(job_url) - + print(f"list_of_job_urls = {list_of_job_urls}") print("^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^") - - print("\nSTEP 3:") + + print("\nSTEP 3:") # v was here self.print_companies_internal_job_opening("company_job_openings", self.application_company_name, JobTitle=job_title, JobLocation=job_location, WorkPlaceTypes=job_workplaceType, CompanyDepartment=company_department, JobTeamInCompany=specialization, JobHREF=job_url, ButtonToJob=apply_href) print("::----------------------------------------------------------------------") @@ -1117,7 +1106,7 @@ def collect_companies_current_job_openings(self, soup): # if heading.find_parent('section') is None: # company_department = heading.text.strip() # print(f"company_department = {company_department}") - + # # Find sections containing company departments and job openings # sections = div_main.find_all('section', class_=lambda x: x and 'level' in x) # for section in sections: @@ -1137,11 +1126,11 @@ def collect_companies_current_job_openings(self, soup): # job_url = self.alter_url_to_job(current_url, job_opening_href) # span_tag_location = job_opening.find('span', {'class', 'location'}) # job_location = span_tag_location.text if span_tag_location else None - + # employment_type = "Testing Tests" - + # self.print_job_details(job_url, job_title, job_location, company_department, employment_type, job_workplaceType, experience_level) - + # if self.check_users_basic_requirements(job_title, job_location, job_workplaceType): # self.current_jobs_details.update({ # 'job_url': job_url, @@ -1163,9 +1152,9 @@ def collect_companies_current_job_openings(self, soup): # print("* *") # print("*\n\n") # return list_of_job_urls - + # ---------------------------------------------------------------------------------------------------------------------------------------------- - + # if self.application_company_name == 'greenhouse': # # Find the main content div # div_main = soup.find("div", id="main") @@ -1192,11 +1181,11 @@ def collect_companies_current_job_openings(self, soup): # job_url = self.alter_url_to_job(current_url, job_opening_href) # span_tag_location = element.find('span', {'class', 'location'}) # job_location = span_tag_location.text if span_tag_location else None - + # employment_type = "Testing Tests" # Adjust as needed - + # self.print_job_details(job_url, job_title, job_location, company_department, employment_type, None, experience_level) - + # if self.check_users_basic_requirements(job_title, job_location, None): # self.current_jobs_details.update({ # 'job_url': job_url, @@ -1218,13 +1207,13 @@ def collect_companies_current_job_openings(self, soup): # print("* *") # print("*\n\n") # return list_of_job_urls - + # ---------------------------------------------------------------------------------------------------------------------------------------------- - + # Find the main div containing job details div_main = soup.find("div", id="main") - - + + # NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW if div_main is not None: sections = div_main.find_all('section', class_=lambda x: x and 'level' in x) @@ -1232,22 +1221,22 @@ def collect_companies_current_job_openings(self, soup): print("div_main not found") sections = [] # NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW NEW - - + + # Find all heading elements headings = soup.find_all(['h1', 'h2', 'h3', 'h4', 'h5', 'h6']) - + #NOTE: ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL # # Sort headings by their level, starting with the highest # sorted_headings = sorted(headings, key=lambda x: int(x.name[1]), reverse=True) - + # # Traverse through sorted headings and find the one without a parent 'section' element # for heading in sorted_headings: # if heading.find_parent('section') is None: # company_department = heading.text.strip() # break #NOTE: ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL ORIGINAL - + # Traverse through headings and find the one with an id consisting only of numbers for heading in headings: heading_id = heading.get('id') @@ -1258,15 +1247,14 @@ def collect_companies_current_job_openings(self, soup): if siblings_with_department_id or children_with_department_id: company_department = heading.text.strip() break - + # Find sections containing company departments and job openings #TODO: OG sections = div_main.find_all('section', class_=lambda x: x and 'level' in x) for section in sections: job_openings = section.find_all('div', {'class': 'opening'}) for job_opening in job_openings: print(":-----------------------------------------------------------------------") - job_opening_href = job_opening.find('a') - if job_opening_href: + if job_opening_href := job_opening.find('a'): job_title = job_opening_href.text if self.users_basic_requirements_job_title(job_title) == False: print(" Job FAILED!!") @@ -1274,9 +1262,9 @@ def collect_companies_current_job_openings(self, soup): continue print(" Job PASSED!!") experience_level = self.get_experience_level(job_title) - - - + + + job_url = job_opening_href.get('href') # span_tag_location = job_opening.find('span', {'class', 'location'}) # job_location = span_tag_location.text if span_tag_location else None @@ -1284,13 +1272,14 @@ def collect_companies_current_job_openings(self, soup): # span_tag_location = job_opening.find('div', {'class', 'location'}) # job_location = span_tag_location.text if span_tag_location else None for tag_name, class_name in [('span', 'location'), ('div', 'location')]: - tag_location = job_opening.find(tag_name, {'class': class_name}) - if tag_location: + if tag_location := job_opening.find( + tag_name, {'class': class_name} + ): job_location = tag_location.text break - + job_workplaceType = self.current_jobs_details.get('job_workplaceType', 'full-time') - + # Print or store the details as required print("\n") print(f"Job Title: {job_title}") @@ -1298,7 +1287,7 @@ def collect_companies_current_job_openings(self, soup): print(f"Job Location: {job_location}") print(f"Company Department: {company_department}") print(":-----------------------------------------------------------------------") - + if self.check_users_basic_requirements(job_title, job_location, job_workplaceType): self.current_jobs_details.update({ 'job_url': job_url, @@ -1311,29 +1300,29 @@ def collect_companies_current_job_openings(self, soup): }) print("STEP 1:") print(f"experience_level = {experience_level}") - print(f"if not experience = ", end="") + print("if not experience = ", end="") print(not experience_level) if not experience_level: - - + + #! HERE TESTING HERE TESTING HERE TESTING HERE TESTING print("STEP 2:") print("\nv v v v v v v v v v v v v v v v v v v") print(f"self.current_jobs_details = {self.current_jobs_details}") print(f"job_url = {job_url}") print(f"list_of_job_urls = {list_of_job_urls}") - + list_of_job_urls.append(job_url) - + print(f"list_of_job_urls = {list_of_job_urls}") print("^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^") - - print("\nSTEP 3:") + + print("\nSTEP 3:") # v was here self.print_companies_internal_job_opening("company_job_openings", self.application_company_name, JobTitle=job_title, JobLocation=job_location, WorkPlaceTypes=job_workplaceType, CompanyDepartment=company_department, JobHREF=job_url) print("::----------------------------------------------------------------------") - - + + print("* * * * *") print("* * * *") print("* * *") @@ -1368,16 +1357,11 @@ def print_companies_internal_job_opening(self, *args, **kwargs): print("print_company_job_openings()") method_name = None for arg in args: - if arg == 'greenhouse': - print(method_name) - print(arg) - for key, value in kwargs.items(): - print(key + ": " + str(value)) - elif arg == 'lever': + if arg in ['greenhouse', 'lever']: print(method_name) print(arg) for key, value in kwargs.items(): - print(key + ": " + str(value)) + print(f"{key}: {str(value)}") else: method_name = arg print('----------------------------------------------------------------------------------------------------') @@ -1436,10 +1420,7 @@ def should_user_apply(self, job_description): everything_about_job = job_description.get_text() #TODO: ADD SpaCy coding-formatting here!!! experience_needed = "You must be a diety! Being a demigod or demigoddess is literally embarrassing... just go back to coloring if this is you. Literally useless & pathetic ewww" - if re.search(experience_needed, everything_about_job): - return False - else: - return True + return not re.search(experience_needed, everything_about_job) #TODO: call self.click_this_button(button) #NOTE: ^ ^ ^ Maybe rename to self.click_this_button_or_scroll() {Better encapsulates all scenarios here} diff --git a/Legit/Form/Four/FormFour.py b/Legit/Form/Four/FormFour.py index 7be1b09..9fd9613 100644 --- a/Legit/Form/Four/FormFour.py +++ b/Legit/Form/Four/FormFour.py @@ -106,7 +106,7 @@ def check_similarity(self, doc1, doc2, key, label, max_similarity): max_similarity = similarity best_match = key if max_similarity == 1.0: - return self.handle_match(key, label), max_similarity + return self.handle_match(best_match, label), max_similarity return best_match, max_similarity def find_the_bestest_match(self, label): #aka - "find_best_match" @@ -138,8 +138,7 @@ def get_synonyms(self, word): synonyms = [] for syn in wordnet.synsets(word): - for lemma in syn.lemmas(): - synonyms.append(lemma.name()) + synonyms.extend(lemma.name() for lemma in syn.lemmas()) #TODO: DOUBLE CHECK THIS!!!!! Your asking for the synonyms of `phone number`?!?!?!?! Do we really want the synonyms for the key and not the label?!?!?! if word.lower() in self.custom_synonyms: #for custom_syn in self.custom_synonyms[word]: @@ -153,14 +152,14 @@ def get_synonyms(self, word): print("self.custom_synonyms = ", end="") print(self.custom_synonyms) - - + + print("synonyms = ", end="") print(synonyms) print("\n--------------------") - + time.sleep(2) - + return synonyms #*Just for me to see what it does!! @@ -174,10 +173,7 @@ def jaccard_similarity(self, sentence1, sentence2): print(f"union = {union}") jaccard_similarity = (len(intersection) / len(union)) print(f"jaccard_similarity = {jaccard_similarity}") - if jaccard_similarity > 90: - return True - else: - return False + return jaccard_similarity > 90 def submit_job_application(self, submit_button): @@ -192,32 +188,6 @@ def submit_job_application(self, submit_button): self.keep_jobs_applied_to_info() #self.sessions_applied_to_info return - - - - - - #submit_button_index = self.form_input_details.get('KEY-NAME') - #submit_button = self.extract_css(submit_button_index['HTML']) - - ''' - submit_button = self.extract_css(submit_button['HTML']) - - self.browser.find_element(By.CSS_SELECTOR, submit_button).click() - - WebDriverWait(self.browser, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, ".response-message"))) - - response_message = self.browser.find_element(By.CSS_SELECTOR, ".response-message").text - if "success" in response_message.lower(): - self.keep_jobs_applied_to_info() - print("Form submission was successful!") - else: - print("Form submission failed!") - - error_messages = self.driver.find_elements(By.CSS_SELECTOR, ".error-message") - for error_message in error_messages: - print(f"Error: {error_message.text}") - ''' #TODO: Add call to oxylabs captcha!!!!! @@ -236,10 +206,8 @@ def is_special_case(self, input_data): if label == 'select': select_element = self.browser.find_element(label) is_multiple_choice = select_element.get_attribute('multiple') is not None - if is_multiple_choice is True: + if is_multiple_choice: self.form_input_extended['text'] = 'is_multiple_choice' - elif is_multiple_choice is False: - pass elif label == 'checkbox': self.form_input_extended['checkbox'] = True self.form_input_extended = 'is_multiple_choice' @@ -247,15 +215,11 @@ def is_special_case(self, input_data): self.form_input_extended['radio'] = True elif label == 'file': self.form_input_extended['file'] = True + elif label in ['text', 'textarea', 'button']: + self.form_input_extended['text'] = True else: - if label == 'text' or label == 'textarea': - self.form_input_extended['text'] = True - elif label == 'button': - self.form_input_extended['text'] = True - - else: - print("There has been an error father...") - print("label = ", label) + print("There has been an error father...") + print("label = ", label) return #TODO: Once we submit the application confirm that here and then save everything!!! diff --git a/Legit/Form/One/FormOne.py b/Legit/Form/One/FormOne.py index f54032a..d08eed4 100644 --- a/Legit/Form/One/FormOne.py +++ b/Legit/Form/One/FormOne.py @@ -53,20 +53,15 @@ def get_label(self, input_element): input_element_str = str(input_element).lower() if 'button' in input_element_str and 'submit application' in input_element_str: return 'Submit Application' - + if input_element.get('type') == 'radio': - label = self.find_radio_label(input_element) - return label - + return self.find_radio_label(input_element) if input_element.get('type') == 'checkbox': div_parent, parents_text = self.get_div_parent(input_element) if div_parent == 'None' or parents_text == 'None': pass elif div_parent and parents_text: - #return div_parent, parents_text - checkbox_values = [div_parent, parents_text] - return checkbox_values - + return [div_parent, parents_text] label = None # Case 1: Check if the label is a direct previous sibling of the input element @@ -74,30 +69,26 @@ def get_label(self, input_element): # Case 2: Check if the label is inside a parent container if not label: - parent = input_element.find_parent() - if parent: + if parent := input_element.find_parent(): label = parent.find('label') # Case 3: Check if the label is associated using the "for" attribute if not label: - input_id = input_element.get('id') - if input_id: + if input_id := input_element.get('id'): label = input_element.find_previous('label', attrs={'for': input_id}) # Case 4: Check if the input element is a child of a label element if not label: - parent_label = input_element.find_parent('label') - if parent_label: + if parent_label := input_element.find_parent('label'): label = parent_label # Case 5: Check if a label is inside a parent container of the input element if not label: - parent = input_element.find_parent() - if parent: + if parent := input_element.find_parent(): label = parent.find('label') - + # Case 6: Checks if the input element has an 'aria-label' meaning it's dynamic so goes & searches - # all previous label containers to see if any have text values that are equal to the aria-label' + # all previous label containers to see if any have text values that are equal to the aria-label' if not label: if 'aria-label' in input_element.attrs: aria_label_match = None @@ -106,30 +97,35 @@ def get_label(self, input_element): if parent_label.text.strip() == aria_label_value: aria_label_match = True if aria_label_match: - dynamic_label = aria_label_value + " (dynamic " + input_element.get('type') + ")" - if dynamic_label: + if ( + dynamic_label := f"{aria_label_value} (dynamic " + + input_element.get('type') + + ")" + ): return dynamic_label - elif aria_label_match == None: + elif aria_label_match is None: return aria_label_value - + # Case 7: Checks if the input element's style attribute is equal to 'display: none;' meaning it's # dynamic so goes & searches for the most previous label container to specify its text value is dynamic if not label: if input_element.get('style') == 'display: none;': - previous_input = input_element.find_previous('input') - if previous_input: + if previous_input := input_element.find_previous('input'): parent_label = previous_input.find_previous('label') - dynamic_label = parent_label.text.strip() + " (dynamic " + input_element.get('type') + ")" - if dynamic_label: + if ( + dynamic_label := f"{parent_label.text.strip()} (dynamic " + + input_element.get('type') + + ")" + ): return dynamic_label - + # Case 8: Special case for Resume/CV if not label and self.one_resume_label == False: found_attach = False parent_label = input_element.find_previous('label') label = parent_label self.one_resume_label = True - + current_element = input_element while current_element: if isinstance(current_element, NavigableString) and 'attach' in str(current_element).lower(): @@ -138,8 +134,7 @@ def get_label(self, input_element): current_element = current_element.next_sibling # Traverse up from the specific_element and find the label tag if found_attach: - label_tag = input_element.find_previous('label') - if label_tag: + if label_tag := input_element.find_previous('label'): # Check if the immediate child is a text value first_child = label_tag.contents[0] if isinstance(first_child, NavigableString) and first_child.strip(): @@ -156,8 +151,10 @@ def get_label(self, input_element): # Check if the label contains a nested div element with the class "application-label" (case for Input 18) if label: - app_label = label.find(lambda tag: 'class' in tag.attrs and 'application-label' in tag['class']) - if app_label: + if app_label := label.find( + lambda tag: 'class' in tag.attrs + and 'application-label' in tag['class'] + ): label = app_label if label: @@ -174,9 +171,7 @@ def get_label(self, input_element): return label_text - # Case 6: Check if the input_element has a placeholder attribute - placeholder = input_element.get('placeholder') - if placeholder: + if placeholder := input_element.get('placeholder'): return f"Placeholder ~ {placeholder}" return None @@ -185,13 +180,12 @@ def find_radio_label(self, element, stop_level=5): current_level = 0 while (current_level <= stop_level): print(f"Level {current_level}:") - if current_level == 0 or current_level == 5: - if current_level == 0: - print(element.prettify()) - if current_level == 5: - sauce = element.next_element.get_text(strip=True) - print(sauce) - return sauce + if current_level == 0: + print(element.prettify()) + elif current_level == 5: + sauce = element.next_element.get_text(strip=True) + print(sauce) + return sauce element = element.parent current_level += 1 @@ -224,9 +218,9 @@ def get_div_parent(self, input_element): def get_form_input_details(self, url): self.one_resume_label = False - + print("\nget_form_input_details()") - print("URL = " + url) + print(f"URL = {url}") page = requests.get(url) soup = BeautifulSoup(page.content, 'lxml') @@ -259,9 +253,7 @@ def get_form_input_details(self, url): values = [] if input_type == 'select': options = field.find_all('option') - for option in options: - values.append(option.text.strip()) - + values.extend(option.text.strip() for option in options) if input_type == 'radio': radio_name = field.get('name') if radio_name in processed_radios: @@ -270,10 +262,10 @@ def get_form_input_details(self, url): radio_group = soup.find_all('input', {'name': radio_name}) values = [radio.get('value') for radio in radio_group] input_html = ''.join([str(radio).strip() for radio in radio_group]) - + # Call get_label for the entire radio button group input_label = self.get_label(field) - + elif input_type == 'checkbox': if field in processed_radios: continue @@ -290,7 +282,7 @@ def get_form_input_details(self, url): for index, input_element in enumerate(checkbox_group): parent_label = input_element.find_previous('label') if input_element.get('type') == 'text': - values.append(parent_label.text.strip() + "(dynamic)") + values.append(f"{parent_label.text.strip()}(dynamic)") continue values.append(parent_label.text.strip()) processed_radios.add(input_element) diff --git a/Legit/Form/Three/FormThree.py b/Legit/Form/Three/FormThree.py index ca40f5d..a407634 100644 --- a/Legit/Form/Three/FormThree.py +++ b/Legit/Form/Three/FormThree.py @@ -56,10 +56,6 @@ def process_form_inputs(self, form_input_details): continue print("This is -> == None ...straight-up") - if input_data['label'] is None: - print("Dang so -> == None ...straight-up") - continue - print("This is -> == None IT'S A STRING") if input_data['label'] == 'None': print("Dang so -> == None IT'S A STRING") @@ -111,8 +107,7 @@ def process_form_inputs(self, form_input_details): print("TIME FOR COMPARISONS! DO YOU HEAR THAT BUTT-HEAD!!! WE ARE GONNA BE COMPARING BUTTS!!") if input_type in ['select', 'radio', 'checkbox']: print("Ahhhhhhh yes it is either one of these: 'select', 'radio', 'checkbox'") - matching_keys = self.get_matching_keys(label) #! .get_matching_keys() does all the comaparing to get the right answer!!!!! ssooo there do special case check -> .env chack -> long q>a ... a>a check!!! - if matching_keys: + if matching_keys := self.get_matching_keys(label): #!HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE HERE print("self.form_input_extended = ", self.form_input_extended) for key in matching_keys: @@ -149,11 +144,9 @@ def process_form_inputs(self, form_input_details): #self.fill_form(label, answer) else: context = self.q_and_a['summary'] + " " + label - answer = self.generate_response(context) - if answer: + if answer := self.generate_response(context): # Input the answer into the form print(f"Entering '{answer}' for '{label}'") - #self.fill_form(label, answer) else: print(f"No stored answers found for '{label}'") self.form_input_extended['env_html'] = self.extract_css(input_data['html']) diff --git a/Legit/Form/Two/FormTwo.py b/Legit/Form/Two/FormTwo.py index fd06b47..70d9b32 100644 --- a/Legit/Form/Two/FormTwo.py +++ b/Legit/Form/Two/FormTwo.py @@ -47,12 +47,11 @@ def fill_that_form(self): value = self.form_input_extended['env_values'][0] print("element = ", element) print("value = ", value) - success = self.troubleshoot_form_filling(element, value) - if not success: - print("Failed to fill in the form. See the error messages above for details.") - else: + if success := self.troubleshoot_form_filling(element, value): print("Successfully filled in the form.") - + + else: + print("Failed to fill in the form. See the error messages above for details.") #This v checks if the "value" is 'empty' or 'None' #if self.form_input_extended['bc_nick_said']: if 'bc_nick_said' in self.form_input_extended: @@ -71,7 +70,7 @@ def fill_that_form(self): print("form_input_ans = ", form_input_ans) form_input_answer = form_input_ans form_input_html = self.form_input_extended['env_html'] - + if form_input_answer: #form_input_html.click() #self.browser.form_input_html.send_keys(form_input_answer) @@ -80,13 +79,13 @@ def fill_that_form(self): print("Text should be inserted => ", form_input_answer) time.sleep(3) return - + elif self.form_input_extended['select'] is True: #form_input_answer = self.form_input_extended['env_values'] for form_input_ans in self.form_input_extended['env_values']: print("form_input_ans = ", form_input_ans) form_input_answer = form_input_ans - + if answer: form_input_html = self.form_input_extended['env_html'] input_select_element = self.form_input_html.find_element(By.TAG_NAME, "input") @@ -99,7 +98,7 @@ def fill_that_form(self): elif form_input_answer is None: form_input_html = self.form_input_extended['env_html'] input_select_element = self.form_input_html.find_element(By.TAG_NAME, "input") - + input_select_element.click() self.input_select_element.send_keys(By.TEXT, form_input_answer) self.send_keys("ENTER") @@ -110,68 +109,76 @@ def fill_that_form(self): print("Otherwise click the correct school!") elif input_select_element is not form_input_answer: raise BreakLoopException - + if self.form_input_extended['radio'] is True: form_input_answer = self.form_input_extended['env_values'] form_input_html = self.form_input_extended['env_html'] - - answer = form_input_html.find_element(By.ID, form_input_answer) - if answer: + + if answer := form_input_html.find_element( + By.ID, form_input_answer + ): answer.click() return elif answer is None: - answer = self.browser.find_element(By.TEXT, form_input_answer) - if answer: + if answer := self.browser.find_element( + By.TEXT, form_input_answer + ): answer.click() elif answer is None: print("Ummmm I have no clue about this [radio] call the police maybe??") - + if self.form_input_extended['checkbox'] is True: #TODO: Utilize the `select_all` || `select_one` from self.form_input_extended[''] form_input_answer = self.form_input_extended['env_values'] form_input_html = self.form_input_extended['env_html'] - - answer = form_input_html.find_element(By.ID, form_input_answer) - if answer: + + if answer := form_input_html.find_element( + By.ID, form_input_answer + ): answer.click() return elif answer is None: - answer = self.browser.find_element(By.TEXT, form_input_answer) - if answer: + if answer := self.browser.find_element( + By.TEXT, form_input_answer + ): answer.click() elif answer is None: print("Ummmm I have no clue about this [checkbox] call the police maybe??") - + if self.form_input_extended['button'] is True: form_input_answer = self.form_input_extended['env_values'] form_input_html = self.form_input_extended['env_html'] - - answer = form_input_html.find_element(By.ID, form_input_answer) - if answer: + + if answer := form_input_html.find_element( + By.ID, form_input_answer + ): answer.click() return elif answer is None: - answer = self.browser.find_element(By.TEXT, form_input_answer) - if answer: + if answer := self.browser.find_element( + By.TEXT, form_input_answer + ): answer.click() elif answer is None: print("Ummmm I have no clue about this [checkbox] call the police maybe??") - + elif self.form_input_extended['file'] is True: form_input_answer = self.form_input_extended['env_values'] form_input_html = self.form_input_extended['env_html'] - - answer = form_input_html.find_element(By.ID, form_input_answer) - if answer: + + if answer := form_input_html.find_element( + By.ID, form_input_answer + ): answer.click() return elif answer is None: - answer = self.browser.find_element(By.TEXT, form_input_answer) - if answer: + if answer := self.browser.find_element( + By.TEXT, form_input_answer + ): answer.click() elif answer is None: print("Ummmm I have no clue about this [file] call the police maybe??") - + if self.form_input_extended['mandatory'] is True and not self.form_input_extended['env_values']: if self.max_similarity < .25: print("prompt user to answer!!!") diff --git a/Legit/GoogleSearch.py b/Legit/GoogleSearch.py index 7b82bb3..449977c 100644 --- a/Legit/GoogleSearch.py +++ b/Legit/GoogleSearch.py @@ -354,7 +354,7 @@ def print_google_search_results(self): print("Results from this Google Search: ") for i, job in enumerate(self.results_from_search): self.job_links_counter += 1 - print("Result #" + str(self.job_links_counter) + " from Google Seaech") + print(f"Result #{self.job_links_counter} from Google Seaech") print("\tJob Title: ", end="") print(job) print("\tLink to Job: ", end="") @@ -367,7 +367,7 @@ def new_print_google_search_results(self): print("Results from this Google Search: ") for i, job in enumerate(self.results_from_search): self.job_links_counter += 1 - print("Result #" + str(i+1) + " from Google Seaech") + print(f"Result #{str(i + 1)} from Google Seaech") print("\tJob Title: ", end="") print(job) print("\tLink to Job: ", end="") @@ -380,7 +380,7 @@ def new_new_print_google_search_results(self): print("Results from this Google Search: ") for i, job in enumerate(self.google_search_results_links): self.job_links_counter += 1 - print("Result #" + str(i+1) + " from Google Seaech") + print(f"Result #{str(i + 1)} from Google Seaech") print("\tJob Title: ", end="") print(self.google_search_banner_titles[i]) print("\tLink to Job: ", end="") diff --git a/Legit/JobSearchWorkflow.py b/Legit/JobSearchWorkflow.py index a7d5c23..a611612 100644 --- a/Legit/JobSearchWorkflow.py +++ b/Legit/JobSearchWorkflow.py @@ -147,34 +147,6 @@ def users_browser_choice(self): users_browser_choice, browser_name = 2, " Safari " #users_browser_choice, browser_name = 3, " Chrome " return users_browser_choice, browser_name - print("When you are done, type ONLY the number of your preferred web browser then press ENTER") - print(f"\t1) FireFox") - print(f"\t2) Safari") - print(f"\t3) Chrome") - print(f"\t4) Edge") - while True: - user_jobs = input() - user_jobs.strip() - - if user_jobs == "1": - users_browser_choice = " FireFox " - break - elif user_jobs == "2": - users_browser_choice = " Safari " - break - elif user_jobs == "3": - users_browser_choice = " Chrome " - break - elif user_jobs == "4": - users_browser_choice = " Edge " - break - else: - print("That's kinda messed up dog... I give you an opportunity to pick and you pick nothing.") - print("You've squandered any further opportunities to decide stuff. I hope you are happy with yourself.") - print("Don't worry, the council shall discuss and provide a pick for you!") - #TODO: Make else just check OS and return number of that OS's web browser!!! - #! THIS IS A while loop.... so it runs until false - return users_browser_choice, browser_name #! I have browser setup called 1st and then users_browser_choice b/c if the user uses the same browser over & over this will remember it!!! def browser_setup(self): @@ -604,8 +576,8 @@ def consolidate_job_links_by_company(self, job_link, job_links_organized_by_comp - def show_warning(message, category, filename, lineno, file=None, line=None): - print(f"Warning: {message}") + def show_warning(self, category, filename, lineno, file=None, line=None): + print(f"Warning: {self}") warnings.showwarning = show_warning #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -715,37 +687,37 @@ def init_gpt_neo(self, model_name): def clean_gpt_out(self, text, remove_breaks=True): from cleantext import clean - cleaned_text = clean(text, - fix_unicode=True, # fix various unicode errors - to_ascii=True, # transliterate to closest ASCII representation - lower=False, # lowercase text - no_line_breaks=remove_breaks, # fully strip line breaks as opposed to only normalizing them - no_urls=True, # replace all URLs with a special token - no_emails=True, # replace all email addresses with a special token - no_phone_numbers=True, # replace all phone numbers with a special token - no_numbers=False, # replace all numbers with a special token - no_digits=False, # replace all digits with a special token - no_currency_symbols=True, # replace all currency symbols with a special token - no_punct=False, # remove punctuations - replace_with_punct="", # instead of removing punctuations you may replace them - replace_with_url="", - replace_with_email="", - replace_with_phone_number="", - replace_with_number="", - replace_with_digit="0", - replace_with_currency_symbol="", - lang="en" # set to 'de' for German special handling - ) - return cleaned_text + return clean( + text, + fix_unicode=True, # fix various unicode errors + to_ascii=True, # transliterate to closest ASCII representation + lower=False, # lowercase text + no_line_breaks=remove_breaks, # fully strip line breaks as opposed to only normalizing them + no_urls=True, # replace all URLs with a special token + no_emails=True, # replace all email addresses with a special token + no_phone_numbers=True, # replace all phone numbers with a special token + no_numbers=False, # replace all numbers with a special token + no_digits=False, # replace all digits with a special token + no_currency_symbols=True, # replace all currency symbols with a special token + no_punct=False, # remove punctuations + replace_with_punct="", # instead of removing punctuations you may replace them + replace_with_url="", + replace_with_email="", + replace_with_phone_number="", + replace_with_number="", + replace_with_digit="0", + replace_with_currency_symbol="", + lang="en", # set to 'de' for German special handling + ) def test_gpt_neo(self, model_name): print("\ntest_gpt_neo()") print("The module name of GPT-Neo-2.7B is ", end='') print(GPTNeoForCausalLM.__module__) - + device = 0 if torch.cuda.is_available() else -1 generator = pipeline("text-generation", model=model_name, device=device) - + prompt = "Question: Is Bengali, India in the United States?" response_min_chars = 10 response_max_chars = 500 @@ -754,18 +726,18 @@ def test_gpt_neo(self, model_name): import gc from datetime import timedelta gc.collect() - - - + + + with warnings.catch_warnings(record=True) as w: #https://stackoverflow.com/questions/7370801/how-do-i-measure-elapsed-time-in-python start_time = time.time() - + warnings.filterwarnings("always", module='transformers.models.gpt_neo.modeling_gpt_neo') #All WARNINGS that GPT-Neo caused # warnings.filterwarnings("always", module='transformers.GPTNeoForCausalLM') # warnings.filterwarnings("always", module='transformers.GPT2Tokenizer') - + try: response = generator(prompt, do_sample=True, min_length=response_min_chars, max_length=response_max_chars, clean_up_tokenization_spaces=True, @@ -773,18 +745,18 @@ def test_gpt_neo(self, model_name): except Exception as e: print("An error occured while running the generator()") print(e) - + end_time = time.time() elapsed_time = end_time - start_time print(f"The generator() took {str(timedelta(seconds=elapsed_time))}") - + print("----------------------\n") for warnins in w: - print(str(warnins.message)) - - - - + print(warnins.message) + + + + gc.collect() print("Prompt: \n") pp.pprint(prompt) diff --git a/Legit/UsersFirstUse.py b/Legit/UsersFirstUse.py index bd728a2..ca495d5 100644 --- a/Legit/UsersFirstUse.py +++ b/Legit/UsersFirstUse.py @@ -213,11 +213,10 @@ def users_NLP_model(self): + " https://huggingface.co/EleutherAI/gpt-neo-2.7B/tree/main") def set_spacy(self): - print(f"Alright the next big setup is SpaCy!") + print("Alright the next big setup is SpaCy!") print("\t1) en_core_web_sm => 12 MB") print("\t2) en_core_web_md => 40 MB") print("\t3) en_core_web_lg => 560 MB") - #If this is chosen you want to run => 'python -m spacy download en_core_web_lg' print("Type the number, and only the number, of the one you want!") user_exp = input() if self.validate_user_exp(user_exp): diff --git a/XXX_Server/API/Routes/jobs.py b/XXX_Server/API/Routes/jobs.py index 1011d8b..d3f5144 100644 --- a/XXX_Server/API/Routes/jobs.py +++ b/XXX_Server/API/Routes/jobs.py @@ -8,9 +8,7 @@ @router.post("/add") async def add_job_endpoint(job: job): - #Validate and add job data - result = add_job(job) - return result + return add_job(job) @router.get("/statistics/") async def get_job_statistics(): diff --git a/XXX_Server/API/Routes/users.py b/XXX_Server/API/Routes/users.py index 9f3d275..2fb20bc 100644 --- a/XXX_Server/API/Routes/users.py +++ b/XXX_Server/API/Routes/users.py @@ -6,9 +6,7 @@ @router.post("/add/") async def add_user_endpoint(user: User): - #Validate and add user data - result = add_user(user) - return result + return add_user(user) #TODO: Get rid of this!! @router.get("/{user_id}/jobs/") diff --git a/XXX_Server/API/main.py b/XXX_Server/API/main.py index 743f641..2c24010 100644 --- a/XXX_Server/API/main.py +++ b/XXX_Server/API/main.py @@ -49,9 +49,7 @@ def check_if_user_wants_update(): async def check_for_update(): app_current_version = utils.get_app_current_version() - if users_app_current_version < app_current_version: - return True - return False + return users_app_current_version < app_current_version