Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
use Literal String Interpolation
Browse files Browse the repository at this point in the history
  • Loading branch information
hjacobs committed Aug 29, 2018
1 parent 6d18f26 commit aea7ac9
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions kube_resource_report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
ONE_MEBI = 1024 ** 2
ONE_GIBI = 1024 ** 3

# we show costs per month by default as it leads to easily digestable numbers (for humans)
AVG_DAYS_PER_MONTH = 30.4375
HOURS_PER_DAY = 24
HOURS_PER_MONTH = HOURS_PER_DAY * AVG_DAYS_PER_MONTH
Expand Down Expand Up @@ -63,7 +64,7 @@ def parse_resource(v):

session = requests.Session()
# set a friendly user agent for outgoing HTTP requests
session.headers["User-Agent"] = "kube-resource-report/{}".format(__version__)
session.headers["User-Agent"] = f"kube-resource-report/{__version__}"


def request(cluster, path, **kwargs):
Expand Down Expand Up @@ -93,7 +94,7 @@ def json_default(obj):
def query_cluster(
cluster, executor, system_namespaces, additional_cost_per_cluster, no_ingress_status, node_label
):
logger.info("Querying cluster {} ({})..".format(cluster.id, cluster.api_server_url))
logger.info(f"Querying cluster {cluster.id} ({cluster.api_server_url})..")
pods = {}
nodes = {}

Expand Down Expand Up @@ -283,9 +284,7 @@ def query_cluster(
ingress = [namespace, name, application, rule["host"], 0]
if not no_ingress_status:
futures[
futures_session.get(
"https://{}/".format(rule["host"]), timeout=5
)
futures_session.get(f"https://{rule['host']}/", timeout=5)
] = ingress
cluster_summary["ingresses"].append(ingress)

Expand Down

0 comments on commit aea7ac9

Please sign in to comment.