Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sourcery refactored main branch #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Sep 17, 2023

Branch main refactored by Sourcery.

If you're happy with these changes, merge this Pull Request using the Squash and merge strategy.

See our documentation here.

Run Sourcery locally

Reduce the feedback loop during development by using the Sourcery editor plugin:

Review changes via command line

To manually merge these changes, make sure you're on the main branch, then run:

git fetch origin sourcery/main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from Liebmann5 September 17, 2023 09:28
Comment on lines -22 to +32
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!!!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function validate_job_data refactored with the following changes:

Comment on lines 12 to 21

# 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(),
)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function sign_data refactored with the following changes:

This removes the following comments ( why? ):

# return signature.hex()    #used this when I didn't have any default_backend code!!!
# Create a signature


Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CompanyWorkflow.company_workflow refactored with the following changes:

This removes the following comments ( why? ):

# NEW NEW NEW NEW
#! FAILS: If "Internal-Job-Listings" is the initial webpage this ruins
#TODO: refactor this!

Comment on lines -442 to +438
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__', '')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CompanyWorkflow.check_language_of_webpage refactored with the following changes:

This removes the following comments ( why? ):

# if language_of_webpage == 'en':
# = = = =
#     return False
#TODO: Determine whether this should go here or somewhere else!!
#     return True
# return language_of_webpage == 'en'
# else:

Comment on lines -474 to +463
elements = {

return {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CompanyWorkflow.url_parser refactored with the following changes:

Comment on lines -1371 to +1364
if arg == 'greenhouse':
if arg in ['greenhouse', 'lever']:
print(method_name)
print(arg)
for key, value in kwargs.items():
print(key + ": " + str(value))
elif arg == 'lever':
print(method_name)
print(arg)
for key, value in kwargs.items():
print(key + ": " + str(value))
print(f"{key}: {str(value)}")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CompanyWorkflow.print_companies_internal_job_opening refactored with the following changes:

Comment on lines -1439 to +1423
if re.search(experience_needed, everything_about_job):
return False
else:
return True
return not re.search(experience_needed, everything_about_job)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CompanyWorkflow.should_user_apply refactored with the following changes:

Comment on lines -1898 to +1887

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]
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CompanyWorkflow.get_label refactored with the following changes:

This removes the following comments ( why? ):

# Case 6: Check if the input_element has a placeholder attribute
#return div_parent, parents_text

Comment on lines -2035 to +2016
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
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function CompanyWorkflow.find_radio_label refactored with the following changes:

  • Hoist conditional out of nested conditional [×2] (hoist-if-from-if)
  • Simplify conditional into switch-like form (switch)

print("Result #" + str(self.job_links_counter) + " from Google Seaech")
print(f"Result #{self.job_links_counter} from Google Seaech")
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function scraperGoogle.print_google_search_results refactored with the following changes:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants