Skip to content

Commit c03e921

Browse files
committed
fix copilot findings #1
1 parent 63c8f5a commit c03e921

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

application/community_customizations/actions/azure_billing_retriever/azure_billing_plugin.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def _build_plot_hints(self, rows: List[Dict[str, Any]], columns: Optional[List[D
373373
def _iso_utc(self, dt: datetime.datetime) -> str:
374374
return dt.astimezone(datetime.timezone.utc).isoformat()
375375

376-
def _add_months(dt: datetime.datetime, months: int) -> datetime.datetime:
376+
def _add_months(self, dt: datetime.datetime, months: int) -> datetime.datetime:
377377
# Add (or subtract) months without external deps.
378378
year = dt.year + (dt.month - 1 + months) // 12
379379
month = (dt.month - 1 + months) % 12 + 1
@@ -382,20 +382,20 @@ def _add_months(dt: datetime.datetime, months: int) -> datetime.datetime:
382382
31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month-1])
383383
return dt.replace(year=year, month=month, day=day)
384384

385-
def _first_day_of_month(dt: datetime.datetime) -> datetime.datetime:
385+
def _first_day_of_month(self, dt: datetime.datetime) -> datetime.datetime:
386386
return dt.replace(day=1, hour=0, minute=0, second=0, microsecond=0)
387387

388-
def _last_day_of_month(dt: datetime.datetime) -> datetime.datetime:
388+
def _last_day_of_month(self, dt: datetime.datetime) -> datetime.datetime:
389389
# move to first of next month then subtract one second
390390
next_month = self._add_months(self._first_day_of_month(dt), 1)
391391
return next_month - datetime.timedelta(seconds=1)
392392

393-
def _last_n_months_timeperiod(n: int):
393+
def _last_n_months_timeperiod(self, n: int):
394394
now = datetime.datetime.now(datetime.timezone.utc)
395395
start = self._add_months(now, -n)
396396
return {"from": self._iso_utc(start), "to": self._iso_utc(now)}
397397

398-
def _previous_n_months_timeperiod(n: int):
398+
def _previous_n_months_timeperiod(self, n: int):
399399
today = datetime.datetime.now(datetime.timezone.utc)
400400
first_this_month = self._first_day_of_month(today)
401401
last_of_prev = first_this_month - datetime.timedelta(seconds=1)
@@ -1024,7 +1024,7 @@ def ensure_list(value) -> List[Any]:
10241024
else:
10251025
payload.setdefault("warnings", []).append("Chart rendered but conversation_id was not provided; image not persisted.")
10261026

1027-
time.sleep(5) # give time for image to upload before returning
1027+
#time.sleep(5) # give time for image to upload before returning
10281028
return payload
10291029
except Exception as ex:
10301030
logging.exception("Error while generating chart")
@@ -1718,7 +1718,7 @@ def upload_cosmos_message(self,
17181718
conversation_item = cosmos_conversations_container.read_item(item=conversation_id, partition_key=conversation_id)
17191719
conversation_item['last_updated'] = datetime.datetime.utcnow().isoformat()
17201720
cosmos_conversations_container.upsert_item(conversation_item)
1721-
time.sleep(5) # sleep to allow the message to propogate and the front end to pick it up when receiving the agent response
1721+
#time.sleep(5) # sleep to allow the message to propogate and the front end to pick it up when receiving the agent response
17221722
except Exception as e:
17231723
print(f"[ABP] Error uploading image message to Cosmos DB: {str(e)}")
17241724
logging.error(f"[ABP] Error uploading image message to Cosmos DB: {str(e)}")

0 commit comments

Comments
 (0)