-
Notifications
You must be signed in to change notification settings - Fork 9
Carbon Calculations #767
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
base: main
Are you sure you want to change the base?
Carbon Calculations #767
Conversation
🚀 Plugin Build Successful! ✅A new plugin build has been successfully generated for the changes in this pull request! 🎉 📌 Next Steps
🛠 Powered by GitHub Actions & gh API |
| and format. | ||
| :rtype: str | ||
| """ | ||
| if not self.updated_date or self.updated_date == "": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The or self.updated_date == "" is redundant — not self.updated_date already covers None and empty string.
Simplify to
if not self.updated_date:
return ""
| local_dt = utc_dt.astimezone() | ||
|
|
||
| try: | ||
| locale.setlocale(locale.LC_TIME, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
locale.setlocale(locale.LC_TIME, "") modifies the global process locale, which can have side effects if other threads or components rely on locale settings.
Please revert the locale
try:
current_locale = locale.getlocale(locale.LC_TIME)
locale.setlocale(locale.LC_TIME, "")
formatted_date = local_dt.strftime("%x")
formatted_time = local_dt.strftime("%H:%M")
finally:
locale.setlocale(locale.LC_TIME, current_locale)
| return False | ||
|
|
||
| self.set_status_message( | ||
| f"Zonal statistics calculation started, task id: {task_uuid})" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove ')' at the end
| # Repeatedly poll until final status | ||
| try: | ||
| while not self.isCanceled(): | ||
| response = pooling.results() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If results is somehow None due to some unexpected error, it could raise an error.
We can change it to
response = pooling.results() or {}
status_str = response.get("status")
Addresses #700.