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 master branch #2

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

Conversation

sourcery-ai[bot]
Copy link

@sourcery-ai sourcery-ai bot commented Oct 2, 2023

Branch master 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 master branch, then run:

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

Help us improve this pull request!

@sourcery-ai sourcery-ai bot requested a review from luong-komorebi October 2, 2023 04:25
Comment on lines -8 to +10
for l in f:
if not l.startswith("#"):
install_requires.append(l.split("#", 1)[0].strip())

install_requires.extend(
l.split("#", 1)[0].strip() for l in f if not l.startswith("#")
)
Copy link
Author

Choose a reason for hiding this comment

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

Lines 8-11 refactored with the following changes:

if id is None:
return url

return str(URL(url).with_query({"client_id": id}))
return url if id is None else str(URL(url).with_query({"client_id": id}))
Copy link
Author

Choose a reason for hiding this comment

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

Function build_request_url refactored with the following changes:

Comment on lines -128 to +125
if cilogon_client_id != stored_client_id:
return False

return True
return cilogon_client_id == stored_client_id
Copy link
Author

Choose a reason for hiding this comment

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

Function stored_client_id_same_with_cilogon_records refactored with the following changes:

Comment on lines -162 to +156
client_id = load_client_id_from_file(config_filename)
if client_id:
if client_id := load_client_id_from_file(config_filename):
Copy link
Author

Choose a reason for hiding this comment

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

Function create_client refactored with the following changes:

Comment on lines -297 to +290
if not client_id:
if Path(config_filename).is_file():
client_id = load_client_id_from_file(config_filename)
# Nothing to do if no client has been found
if not client_id:
print_colour(
"No `client_id` to delete was provided and couldn't find any in `config_filename`",
"red",
)
return
else:
print_colour(
f"No `client_id` to delete was provided and couldn't find any {config_filename} file",
"red",
)
return
else:
if client_id:
Copy link
Author

Choose a reason for hiding this comment

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

Function delete_client refactored with the following changes:

Comment on lines -60 to +62
self.cluster.config_path.joinpath(p)
for p in self.spec["helm_chart_values_files"]
) as values_files:
self.cluster.config_path.joinpath(p)
for p in self.spec["helm_chart_values_files"]
) as values_files:
Copy link
Author

Choose a reason for hiding this comment

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

Function Hub.deploy refactored with the following changes:

Comment on lines -64 to -69
# A dictionary to convert row values when they are Boolean
boolean_converter = {
True: "Yes",
False: "No",
}

Copy link
Author

Choose a reason for hiding this comment

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

Function create_markdown_comment refactored with the following changes:

query = f"""
return f"""
Copy link
Author

Choose a reason for hiding this comment

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

Function build_gcp_query refactored with the following changes:

Comment on lines -138 to +137
rows = p.query_range(prom_query, start, end, step)
return rows
return p.query_range(prom_query, start, end, step)
Copy link
Author

Choose a reason for hiding this comment

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

Function PrometheusUtilizationImporter._run_query refactored with the following changes:

Comment on lines -168 to +166
df["support_combined"] = df["support_combined"] + df["support"]
df["support_combined"] += df["support"]
Copy link
Author

Choose a reason for hiding this comment

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

Function PrometheusUtilizationImporter.combine_support refactored with the following changes:

  • Replace assignment with augmented assignment (aug-assign)

Comment on lines -213 to +211
result = bq_importer.get_costs(start_month, end_month)
return result
return bq_importer.get_costs(start_month, end_month)
Copy link
Author

Choose a reason for hiding this comment

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

Function get_dedicated_cluster_costs refactored with the following changes:

Comment on lines -48 to +49
"username": "".join(secrets.choice(alphabet) for i in range(64)),
"password": "".join(secrets.choice(alphabet) for i in range(64)),
"username": "".join(secrets.choice(alphabet) for _ in range(64)),
"password": "".join(secrets.choice(alphabet) for _ in range(64)),
Copy link
Author

Choose a reason for hiding this comment

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

Function generate_support_files refactored with the following changes:

datasource_details = {
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 build_datasource_details refactored with the following changes:

Comment on lines -67 to -73
headers = {
return {
"Accept": "application/json",
"Content-Type": "application/json",
"Authorization": f"Bearer {token}",
}

return headers
Copy link
Author

Choose a reason for hiding this comment

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

Function build_datasource_request_headers refactored with the following changes:

Comment on lines -156 to -157
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 update_central_grafana_datasources refactored with the following changes:

@@ -17,6 +17,7 @@
Pull Request number, and the name of the *other* workflow that we want to provide
a link to.
"""

Copy link
Author

Choose a reason for hiding this comment

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

Lines 56-92 refactored with the following changes:

buf.append(escape_char)
buf.append("%X" % byte)
buf.extend((escape_char, "%X" % byte))
Copy link
Author

Choose a reason for hiding this comment

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

Function _escape_char refactored with the following changes:

Comment on lines -164 to -165
completed_futures = 0

Copy link
Author

Choose a reason for hiding this comment

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

Function main refactored with the following changes:

c = yaml.load(test_cluster)
return c
return yaml.load(test_cluster)
Copy link
Author

Choose a reason for hiding this comment

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

Function cluster refactored with the following changes:

Comment on lines -44 to -51
schema = DataFrameSchema(
return DataFrameSchema(
{
"project": Column(String),
"total_with_credits": Column(Float, Check(lambda x: x > 0.0), coerce=True),
"total_with_credits": Column(
Float, Check(lambda x: x > 0.0), coerce=True
),
},
index=Index(DateTime, name="month"),
)
return schema
Copy link
Author

Choose a reason for hiding this comment

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

Function schema 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