-
Notifications
You must be signed in to change notification settings - Fork 0
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
chore: update version to 1.4.15 and add timezone support in date hand… #40
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
|
||
setup( | ||
name="tc-analyzer-lib", | ||
version="1.4.14", | ||
version="1.4.15", | ||
author="Mohammad Amin Dadgar, TogetherCrew", | ||
maintainer="Mohammad Amin Dadgar", | ||
maintainer_email="[email protected]", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import logging | ||
from datetime import datetime | ||
from datetime import datetime, timezone | ||
|
||
from tc_analyzer_lib.metrics.analyzer_memberactivities import MemberActivities | ||
from tc_analyzer_lib.metrics.heatmaps import Heatmaps | ||
|
@@ -105,7 +105,7 @@ async def run_once(self): | |
action_config=self.action, | ||
window_config=self.window, | ||
analyzer_config=self.analyzer_config, | ||
analyzer_period=self.period, | ||
analyzer_period=self.period.replace(tzinfo=timezone.utc), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Timezone handling needs to be consistent The verification confirms that
🔗 Analysis chainVerify timezone handling in constructor While adding UTC timezone here is correct, we should ensure that Let's verify the timezone handling in the constructor and any potential callers: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for TCAnalyzer instantiations to verify period parameter handling
rg -l "TCAnalyzer\(" | xargs rg -B 5 -A 1 "TCAnalyzer\("
# Search for period parameter assignments in constructor
ast-grep --pattern 'class TCAnalyzer {
$$$
__init__($$$) {
$$$
self.period = period
$$$
}
}'
Length of output: 1543 Script: #!/bin/bash
# Get the complete constructor implementation
ast-grep --pattern 'class TCAnalyzer {
$$$
def __init__($$$) {
$$$
}
}'
# Find period parameter usage in setup_platform.py
rg -B 5 -A 5 "TCAnalyzer\(" tests/integration/utils/setup_platform.py
# Look for period type hints or related imports
rg "from datetime" tc_analyzer_lib/tc_analyzer.py
Length of output: 506 Script: #!/bin/bash
# Try different pattern for constructor
ast-grep --pattern 'class TCAnalyzer($_) {
def __init__(self, $$$) {
$$$
}
}'
# Find period variable definition in setup_platform
rg -B 10 "period=" tests/integration/utils/setup_platform.py
# Look for period-related type hints
rg "period.*:" tc_analyzer_lib/tc_analyzer.py
Length of output: 579 Script: #!/bin/bash
# Find period variable definition with more context
rg -B 15 -A 5 "days_ago_period" tests/integration/utils/setup_platform.py
# Try one more pattern for constructor
ast-grep --pattern 'class TCAnalyzer {
def __init__(self, platform_id: str, period: datetime, $$$) {
$$$
}
}'
Length of output: 2328 |
||
) | ||
( | ||
member_activities_data, | ||
|
@@ -190,7 +190,7 @@ async def recompute(self): | |
action_config=self.action, | ||
window_config=self.window, | ||
analyzer_config=self.analyzer_config, | ||
analyzer_period=self.period, | ||
analyzer_period=self.period.replace(tzinfo=timezone.utc), | ||
) | ||
( | ||
member_activities_data, | ||
|
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.
Ensure consistent timezone handling for all datetime objects.
While
db_analysis_end_date
is now timezone-aware, the comparisons withdate_range_start
anddate_range_end
could raiseTypeError
if they are naive datetime objects.Apply this fix to ensure all datetime comparisons are timezone-aware: