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 Starbot ⭐ refactored DucarrougeR/themis-1 #1

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

Conversation

SourceryAI
Copy link

Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨

Here's your pull request refactoring your most popular Python repo.

If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.

Review changes via command line

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

git fetch https://github.com/sourcery-ai-bot/themis-1 main
git merge --ff-only FETCH_HEAD
git reset HEAD^

Comment on lines -22 to +37
if connection.name not in ('looker', 'looker__ilooker', 'looker__internal__analytics'):
if connection.dialect:
connection_tests = {'tests': connection.dialect.connection_tests}
for test in connection_tests['tests']:
try:
db_validation = self.looker_client.test_connection(connection.name, test)
for item in db_validation:
if item.status != 'success':
db_errors.append("Database Connection {} Test '{}' returned '{}'".format(connection.name,
item.name,
item.message))
except Exception as e:
print("Database Connection test for {} failed due to {}".format(connection.name, e))
if (
connection.name
not in ('looker', 'looker__ilooker', 'looker__internal__analytics')
and connection.dialect
):
connection_tests = {'tests': connection.dialect.connection_tests}
for test in connection_tests['tests']:
try:
db_validation = self.looker_client.test_connection(connection.name, test)
for item in db_validation:
if item.status != 'success':
db_errors.append("Database Connection {} Test '{}' returned '{}'".format(connection.name,
item.name,
item.message))
except Exception as e:
print("Database Connection test for {} failed due to {}".format(connection.name, e))
Copy link
Author

Choose a reason for hiding this comment

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

Function Connectivity.test_db_connections refactored with the following changes:

Comment on lines -56 to -58
else:
# integration_errors.append("Integration {} not enabled.".format(elem.label))
pass
Copy link
Author

Choose a reason for hiding this comment

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

Function Connectivity.test_integrations refactored with the following changes:

This removes the following comments ( why? ):

# integration_errors.append("Integration {} not enabled.".format(elem.label))

Comment on lines 67 to 74
group_errors = []
for elem in all_datagroups:
if elem.trigger_error:
group_errors.append("Datagroup \"{}\" on model \"{}\" has this error:\t{}".format(elem.name,
elem.model_name,
elem.trigger_error))
return group_errors No newline at end of file
return [
"Datagroup \"{}\" on model \"{}\" has this error:\t{}".format(
elem.name, elem.model_name, elem.trigger_error
)
for elem in all_datagroups
if elem.trigger_error
]
Copy link
Author

Choose a reason for hiding this comment

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

Function Connectivity.test_datagroups refactored with the following changes:

for i in range(0, len(error)):
for i in range(len(error)):
Copy link
Author

Choose a reason for hiding this comment

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

Function Content.validate_content refactored with the following changes:

body = '''
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 email_body refactored with the following changes:

Comment on lines -59 to +69
cleaned_errors = []
for elem in json.loads(failed_pdts_list):
# cleaned_errors.append("PDT \'{}\' failed with error: {}".format(elem['pdt_event_log.view_name'], elem['error_message']))
cleaned_errors.append("PDT \'{}\' failed on connection: {}".format(elem['pdt_event_log.view_name'], elem['pdt_event_log.connection']))
cleaned_errors = [
"PDT \'{}\' failed on connection: {}".format(
elem['pdt_event_log.view_name'], elem['pdt_event_log.connection']
)
for elem in json.loads(failed_pdts_list)
]

Copy link
Author

Choose a reason for hiding this comment

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

Function Schedules.get_pdts_status refactored with the following changes:

This removes the following comments ( why? ):

# cleaned_errors.append("PDT \'{}\' failed with error: {}".format(elem['pdt_event_log.view_name'], elem['error_message']))

to_emails = []
for email in email_list.split(','):
to_emails.append(email)
to_emails = [email for email in email_list.split(',')]
Copy link
Author

Choose a reason for hiding this comment

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

Function send_report_out refactored with the following changes:

Comment on lines -25 to +27
disabled_users = []
disabled_users = [i for i in all_users if i.is_disabled]

for i in all_users:
if i.is_disabled:
disabled_users.append(i)
user_results = []
user_results.append("Disabled Looker users: {}".format(len(disabled_users)))
user_results = ["Disabled Looker users: {}".format(len(disabled_users))]
Copy link
Author

Choose a reason for hiding this comment

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

Function Users.get_users_issue refactored with the following changes:

Comment on lines -16 to +21
cred_file = []
for file in os.listdir(parent_dir):
if file.endswith(".ini"):
cred_file.append(os.path.join(parent_dir, file))
cred_file = [
os.path.join(parent_dir, file)
for file in os.listdir(parent_dir)
if file.endswith(".ini")
]

Copy link
Author

Choose a reason for hiding this comment

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

Function LookerSDKTestCase.test_looker_credentials refactored with the following changes:

Comment on lines +33 to -32
regex = r'^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$'
for email in self.__class__.email_list.split(','):
regex = r'^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$'
Copy link
Author

Choose a reason for hiding this comment

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

Function LookerSDKTestCase.test_emails_format 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.

1 participant