eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.DateTimeVisitor

Module implementing a node visitor to check datetime function calls.

Global Attributes

None

Classes

DateTimeVisitor Class implementing a node visitor to check datetime function calls.

Functions

None


DateTimeVisitor

Class implementing a node visitor to check datetime function calls.

Note: This class is modeled after flake8_datetimez v20.10.0 checker.

Derived from

ast.NodeVisitor

Class Attributes

None

Class Methods

None

Methods

DateTimeVisitor Constructor
__getFromKeywords Private method to get a keyword node given its name.
visit_Call Public method to handle a function call.

Static Methods

None

DateTimeVisitor (Constructor)

DateTimeVisitor()

Constructor

DateTimeVisitor.__getFromKeywords

__getFromKeywords(keywords, name)

Private method to get a keyword node given its name.

keywords (list of ast.AST)
list of keyword argument nodes
name (str)
name of the keyword node
Return:
keyword node
Return Type:
ast.AST

DateTimeVisitor.visit_Call

visit_Call(node)

Public method to handle a function call.

Every datetime related function call is check for use of the naive variant (i.e. use without TZ info).

node (ast.Call)
reference to the node to be processed
Up