Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

flake8-datetime-utcnow-plugin

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flake8-datetime-utcnow-plugin

Plugin to check that utcnow() is not used in favour of now(UTC)

  • 0.1.2
  • PyPI
  • Socket score

Maintainers
1

flake8_datetime_utcnow_plugin

Rationale

Plugin for flake8 to warn the developer of the usage of datetime.utcnow().

The problem with datetme.utcnow() is that indeed returns the current timestamp in the UTC timzone but the object is a naive datetime, that is doesn't have the tzinfo argument set.

Instead [datetime.now()](https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow] should be used passing the UTC timezone:

from datetime import datetime, timezone

datetime.now(timezone.utc)

Installation

To install the plugin and flake8:

pip install flake8_datetime_utcnow_plugin

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc