Skip to content

Commit

Permalink
Merge branch 'main' into refactor-01
Browse files Browse the repository at this point in the history
  • Loading branch information
boushrabettir committed Oct 4, 2023
2 parents a6a7c59 + 54cdb4a commit a9b694e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 18 deletions.
11 changes: 11 additions & 0 deletions blocklist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class BlockList:
"""A class holding methods to determine if a company is blocklisted"""

BLOCKLISTED_COMPANIES = set(
["Pattern Learning AI - Career & Tech Recruitment Reimagined!"]
)

def is_blacklisted_company(self, company: str) -> bool:
"""Determines if the company is blacklisted or not"""

return True if company in self.BLOCKLISTED_COMPANIES else False
39 changes: 21 additions & 18 deletions utility/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
import argparse
import json
from bs4 import BeautifulSoup
from opportunity import Opportunity, OpportunityType
from opportunity import Opportunity
from blocklist import BlockList

# ----------------- FOR CLI LIBRARY COMMAND -----------------

Expand Down Expand Up @@ -93,23 +94,25 @@ def blueprint_opportunity_formatter(
internship_list = []
for elem in div:
company = elem.find(class_=company_elem).text.strip()
title = elem.find(class_=title_elem).text.strip()
location = elem.find(class_=location_elem).text.strip()
link = elem.find(class_=link_elem)["href"].split("?")[0]
processed = 0

date_difference = calculate_day_difference(elem)
if len(internship_list) < len_of_jobs:
if date_limit and int(days_needed_command_value) >= date_difference:
opportunity = Opportunity(
company, title, location, link, processed, opp_type
)
else:
opportunity = Opportunity(
company, title, location, link, processed, opp_type
)

internship_list.append(opportunity)
if not BlockList().is_blacklisted_company(company):
title = elem.find(class_=title_elem).text.strip()
location = elem.find(class_=location_elem).text.strip()
link = elem.find(class_=link_elem)["href"].split("?")[0]
processed = 0

date_difference = calculate_day_difference(elem)

if len(internship_list) < len_of_jobs:
if date_limit and int(days_needed_command_value) >= date_difference:
opportunity = Opportunity(
company, title, location, link, processed, opp_type
)
else:
opportunity = Opportunity(
company, title, location, link, processed, opp_type
)

internship_list.append(opportunity)

return internship_list

Expand Down

0 comments on commit a9b694e

Please sign in to comment.