Skip to content

Commit bc571c1

Browse files
committed
style: fix Black formatting on GitHub pricing files
1 parent 129eb3a commit bc571c1

File tree

4 files changed

+510
-476
lines changed

4 files changed

+510
-476
lines changed

src/azure_pricing_mcp/github_pricing/formatters.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
from typing import Any
66

7-
87
# ── github_pricing ──────────────────────────────────────────────────────
98

9+
1010
def format_github_pricing_response(result: dict[str, Any]) -> str:
1111
"""Format the ``github_pricing`` response for display."""
1212
sections = result.get("sections", {})
@@ -56,6 +56,7 @@ def _format_empty_pricing(result: dict[str, Any]) -> str:
5656

5757
# ── Plans ───────────────────────────────────────────────────────────────
5858

59+
5960
def _append_plans_section(lines: list[str], plans: list[dict[str, Any]]) -> None:
6061
lines.append("#### GitHub Plans\n")
6162
lines.append("| Plan | Monthly / user | Target |")
@@ -68,6 +69,7 @@ def _append_plans_section(lines: list[str], plans: list[dict[str, Any]]) -> None
6869

6970
# ── Copilot ─────────────────────────────────────────────────────────────
7071

72+
7173
def _append_copilot_section(lines: list[str], plans: list[dict[str, Any]]) -> None:
7274
lines.append("#### GitHub Copilot\n")
7375
lines.append("| Plan | Monthly | Annual | Target |")
@@ -81,6 +83,7 @@ def _append_copilot_section(lines: list[str], plans: list[dict[str, Any]]) -> No
8183

8284
# ── Actions ─────────────────────────────────────────────────────────────
8385

86+
8487
def _append_actions_section(lines: list[str], data: dict[str, Any]) -> None:
8588
lines.append("#### GitHub Actions Runners\n")
8689
lines.append("| Runner | $/min | OS | Cores |")
@@ -108,6 +111,7 @@ def _append_actions_section(lines: list[str], data: dict[str, Any]) -> None:
108111

109112
# ── Security ────────────────────────────────────────────────────────────
110113

114+
111115
def _append_security_section(lines: list[str], products: list[dict[str, Any]]) -> None:
112116
lines.append("#### GitHub Advanced Security\n")
113117
for p in products:
@@ -121,6 +125,7 @@ def _append_security_section(lines: list[str], products: list[dict[str, Any]]) -
121125

122126
# ── Codespaces ──────────────────────────────────────────────────────────
123127

128+
124129
def _append_codespaces_section(lines: list[str], data: dict[str, Any]) -> None:
125130
lines.append("#### GitHub Codespaces\n")
126131
compute = data.get("compute", {})
@@ -132,6 +137,7 @@ def _append_codespaces_section(lines: list[str], data: dict[str, Any]) -> None:
132137

133138
# ── Storage / Add-ons ───────────────────────────────────────────────────
134139

140+
135141
def _append_storage_section(lines: list[str], items: list[dict[str, Any]]) -> None:
136142
lines.append("#### Storage & Packages\n")
137143
lines.append("| Product | Price | Unit |")
@@ -143,6 +149,7 @@ def _append_storage_section(lines: list[str], items: list[dict[str, Any]]) -> No
143149

144150
# ── github_cost_estimate ────────────────────────────────────────────────
145151

152+
146153
def format_github_cost_estimate_response(result: dict[str, Any]) -> str:
147154
"""Format the ``github_cost_estimate`` response for display."""
148155
lines: list[str] = [

src/azure_pricing_mcp/services/github_pricing.py

Lines changed: 81 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,15 @@ async def estimate_cost(
140140
plan_data = GITHUB_PLANS.get(plan_key)
141141
if plan_data:
142142
plan_cost = plan_data["price_monthly"] * users
143-
breakdown.append({
144-
"item": f"GitHub {plan_key} plan",
145-
"quantity": users,
146-
"unit": "users",
147-
"unit_price": plan_data["price_monthly"],
148-
"monthly_cost": round(plan_cost, 2),
149-
})
143+
breakdown.append(
144+
{
145+
"item": f"GitHub {plan_key} plan",
146+
"quantity": users,
147+
"unit": "users",
148+
"unit_price": plan_data["price_monthly"],
149+
"monthly_cost": round(plan_cost, 2),
150+
}
151+
)
150152
total += plan_cost
151153

152154
# 2. Copilot cost
@@ -155,13 +157,15 @@ async def estimate_cost(
155157
copilot_data = GITHUB_COPILOT_PLANS.get(copilot_key)
156158
if copilot_data:
157159
copilot_cost = copilot_data["price_monthly"] * users
158-
breakdown.append({
159-
"item": f"GitHub Copilot {copilot_key}",
160-
"quantity": users,
161-
"unit": "users",
162-
"unit_price": copilot_data["price_monthly"],
163-
"monthly_cost": round(copilot_cost, 2),
164-
})
160+
breakdown.append(
161+
{
162+
"item": f"GitHub Copilot {copilot_key}",
163+
"quantity": users,
164+
"unit": "users",
165+
"unit_price": copilot_data["price_monthly"],
166+
"monthly_cost": round(copilot_cost, 2),
167+
}
168+
)
165169
total += copilot_cost
166170

167171
# 3. Actions minutes (beyond free tier)
@@ -172,67 +176,77 @@ async def estimate_cost(
172176
runner = GITHUB_ACTIONS_RUNNERS.get(runner_key)
173177
rate = runner["per_minute"] if runner else 0.008
174178
actions_cost = billable_mins * rate
175-
breakdown.append({
176-
"item": f"Actions minutes ({runner_key})",
177-
"quantity": billable_mins,
178-
"unit": f"billable minutes (after {free_mins} free)",
179-
"unit_price": rate,
180-
"monthly_cost": round(actions_cost, 2),
181-
})
179+
breakdown.append(
180+
{
181+
"item": f"Actions minutes ({runner_key})",
182+
"quantity": billable_mins,
183+
"unit": f"billable minutes (after {free_mins} free)",
184+
"unit_price": rate,
185+
"monthly_cost": round(actions_cost, 2),
186+
}
187+
)
182188
total += actions_cost
183189

184190
# 4. Codespaces compute
185191
if codespaces_hours > 0:
186192
cs_rate = GITHUB_ADDONS["Codespaces Compute"]["price"]
187193
core_hours = codespaces_hours * codespaces_cores
188194
cs_cost = core_hours * cs_rate
189-
breakdown.append({
190-
"item": "Codespaces Compute",
191-
"quantity": core_hours,
192-
"unit": "core-hours",
193-
"unit_price": cs_rate,
194-
"monthly_cost": round(cs_cost, 2),
195-
})
195+
breakdown.append(
196+
{
197+
"item": "Codespaces Compute",
198+
"quantity": core_hours,
199+
"unit": "core-hours",
200+
"unit_price": cs_rate,
201+
"monthly_cost": round(cs_cost, 2),
202+
}
203+
)
196204
total += cs_cost
197205

198206
# 5. Codespaces storage
199207
if codespaces_storage_gb > 0:
200208
cs_stor_rate = GITHUB_ADDONS["Codespaces Storage"]["price"]
201209
cs_stor_cost = codespaces_storage_gb * cs_stor_rate
202-
breakdown.append({
203-
"item": "Codespaces Storage",
204-
"quantity": codespaces_storage_gb,
205-
"unit": "GB",
206-
"unit_price": cs_stor_rate,
207-
"monthly_cost": round(cs_stor_cost, 2),
208-
})
210+
breakdown.append(
211+
{
212+
"item": "Codespaces Storage",
213+
"quantity": codespaces_storage_gb,
214+
"unit": "GB",
215+
"unit_price": cs_stor_rate,
216+
"monthly_cost": round(cs_stor_cost, 2),
217+
}
218+
)
209219
total += cs_stor_cost
210220

211221
# 6. Git LFS
212222
if lfs_packs > 0:
213223
lfs_rate = GITHUB_ADDONS["Git LFS Data"]["price"]
214224
lfs_cost = lfs_packs * lfs_rate
215-
breakdown.append({
216-
"item": "Git LFS Data Packs",
217-
"quantity": lfs_packs,
218-
"unit": "50 GB packs",
219-
"unit_price": lfs_rate,
220-
"monthly_cost": round(lfs_cost, 2),
221-
})
225+
breakdown.append(
226+
{
227+
"item": "Git LFS Data Packs",
228+
"quantity": lfs_packs,
229+
"unit": "50 GB packs",
230+
"unit_price": lfs_rate,
231+
"monthly_cost": round(lfs_cost, 2),
232+
}
233+
)
222234
total += lfs_cost
223235

224236
# 7. GHAS
225237
if ghas_committers > 0:
226238
ghas_data = GITHUB_SECURITY_PRODUCTS["GitHub Advanced Security (GHAS)"]
227239
ghas_rate = ghas_data["price_monthly_per_committer"]
228240
ghas_cost = ghas_committers * ghas_rate
229-
breakdown.append({
230-
"item": "GitHub Advanced Security (GHAS)",
231-
"quantity": ghas_committers,
232-
"unit": "active committers",
233-
"unit_price": ghas_rate,
234-
"monthly_cost": round(ghas_cost, 2),
235-
})
241+
breakdown.append(
242+
{
243+
"item": "GitHub Advanced Security (GHAS)",
244+
"quantity": ghas_committers,
245+
"unit": "active committers",
246+
"unit_price": ghas_rate,
247+
"monthly_cost": round(ghas_cost, 2),
248+
}
249+
)
236250
total += ghas_cost
237251

238252
return {
@@ -304,30 +318,32 @@ def _get_copilot(plan_filter: str | None = None) -> list[dict[str, Any]]:
304318
if plan_filter:
305319
if name.lower() != plan_filter.strip().lower():
306320
continue
307-
result.append({
308-
"name": name,
309-
"price_monthly": data["price_monthly"],
310-
"price_annual": data["price_annual"],
311-
"target": data["target"],
312-
"includes": data["includes"],
313-
})
321+
result.append(
322+
{
323+
"name": name,
324+
"price_monthly": data["price_monthly"],
325+
"price_annual": data["price_annual"],
326+
"target": data["target"],
327+
"includes": data["includes"],
328+
}
329+
)
314330
return result
315331

316332
@staticmethod
317333
def _get_actions() -> dict[str, Any]:
318334
runners = []
319335
for label, data in GITHUB_ACTIONS_RUNNERS.items():
320-
runners.append({
321-
"runner": label,
322-
"per_minute": data["per_minute"],
323-
"os": data["os"],
324-
"cores": data["cores"],
325-
})
336+
runners.append(
337+
{
338+
"runner": label,
339+
"per_minute": data["per_minute"],
340+
"os": data["os"],
341+
"cores": data["cores"],
342+
}
343+
)
326344
return {
327345
"runners": runners,
328-
"free_minutes": {
329-
plan: info for plan, info in GITHUB_ACTIONS_FREE_MINUTES.items()
330-
},
346+
"free_minutes": {plan: info for plan, info in GITHUB_ACTIONS_FREE_MINUTES.items()},
331347
"multipliers": {
332348
"Linux": 1,
333349
"Windows": 2,

0 commit comments

Comments
 (0)