MAINT: Updated f-string method (#6230)

* MAINT: Used f-string method

Updated the code with f-string methods wherever required for a better and cleaner understanding of the code.

* Updated files with f-string method

* Update rsa_key_generator.py

* Update rsa_key_generator.py

* Update elgamal_key_generator.py

* Update lru_cache.py

I don't think this change is efficient but it might tackle the error as the error was due to using long character lines.

* Update lru_cache.py

* Update lru_cache.py

Co-authored-by: cyai <seriesscar@gmail.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
Vardhaman
2022-07-07 20:04:07 +05:30
committed by GitHub
parent 0a0f4986e4
commit 2d5dd6f132
18 changed files with 39 additions and 44 deletions

View File

@ -47,9 +47,9 @@ def main():
y_pred = model.predict(X_test)
# The mean squared error
print("Mean squared error: %.2f" % mean_squared_error(y_test, y_pred))
print(f"Mean squared error: {mean_squared_error(y_test, y_pred):.2f}")
# Explained variance score: 1 is perfect prediction
print("Test Variance score: %.2f" % r2_score(y_test, y_pred))
print(f"Test Variance score: {r2_score(y_test, y_pred):.2f}")
# So let's run the model against the test data
fig, ax = plt.subplots()

View File

@ -164,9 +164,7 @@ def kmeans(
num_changed = np.sum(prev_cluster_assignment != cluster_assignment)
if verbose:
print(
" {:5d} elements changed their cluster assignment.".format(
num_changed
)
f" {num_changed:5d} elements changed their cluster assignment."
)
# Record heterogeneity convergence metric

View File

@ -99,7 +99,7 @@ def main():
len_result = theta.shape[1]
print("Resultant Feature vector : ")
for i in range(0, len_result):
print("%.5f" % (theta[0, i]))
print(f"{theta[0, i]:.5f}")
if __name__ == "__main__":