Ruff lint rule that warns against datetime.utcfromtimestamp and suggests timezone-aware alternatives.
// Source: https://github.com/astral-sh/ruff | License: MIT | Copyright 2022 Charles Marsh
// Provided via justclaw.it.com; keep this notice with the code.
use ruff_python_ast::Expr;
use ruff_text_size::TextRange;
use ruff_macros::{ViolationMetadata, derive_message_formats};
use ruff_python_semantic::Modules;
use crate::Violation;
use crate::checkers::ast::Checker;
use crate::codes::Category;
use crate::rules::flake8_datetimez::helpers;
/// ## What it does
/// Checks for usage of `datetime.datetime.utcfromtimestamp()`.
///
/// ## Why is this bad?
/// Python datetime objects can be naive or timezone-aware. While an aware
/// object represents a specific moment in time, a naive object does not
/// contain enough information to unambiguously locate itself relative to other
/// datetime ob
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key