The file locking in _analyze_smart_trends opens with mode 'r+' or 'w+' but doesn't handle the case where the file is created empty:
file_mode = 'r+' if os.path.exists(historical_file) else 'w+'
...
if os.path.getsize(historical_file) > 0: # This check happens AFTER opening
Fix:
Check file existence and size BEFORE opening
if os.path.exists(historical_file) and os.path.getsize(historical_file) > 0:
file_mode = 'r+'
else:
file_mode = 'w+'
The file locking in _analyze_smart_trends opens with mode 'r+' or 'w+' but doesn't handle the case where the file is created empty:
file_mode = 'r+' if os.path.exists(historical_file) else 'w+'
# ...
if os.path.getsize(historical_file) > 0: # This check happens AFTER opening
Fix:
# Check file existence and size BEFORE opening
if os.path.exists(historical_file) and os.path.getsize(historical_file) > 0:
file_mode = 'r+'
else:
file_mode = 'w+'
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The file locking in _analyze_smart_trends opens with mode 'r+' or 'w+' but doesn't handle the case where the file is created empty:
file_mode = 'r+' if os.path.exists(historical_file) else 'w+'
...
if os.path.getsize(historical_file) > 0: # This check happens AFTER opening
Fix:
Check file existence and size BEFORE opening
if os.path.exists(historical_file) and os.path.getsize(historical_file) > 0:
file_mode = 'r+'
else:
file_mode = 'w+'