mirror of
https://github.com/github/codeql.git
synced 2026-07-01 01:25:33 +02:00
Python: Add parser support for lazy imports
As defined in PEP-810. We implement this in much the same way as how we handle `async` annotations currently. The relevant nodes get an `is_lazy` field that defaults to being false.
This commit is contained in:
@@ -845,17 +845,19 @@ class If(stmt):
|
||||
|
||||
|
||||
class Import(stmt):
|
||||
__slots__ = "names",
|
||||
__slots__ = "is_lazy", "names",
|
||||
|
||||
def __init__(self, names):
|
||||
def __init__(self, names, is_lazy=False):
|
||||
self.names = names
|
||||
self.is_lazy = is_lazy
|
||||
|
||||
|
||||
class ImportFrom(stmt):
|
||||
__slots__ = "module",
|
||||
__slots__ = "is_lazy", "module",
|
||||
|
||||
def __init__(self, module):
|
||||
def __init__(self, module, is_lazy=False):
|
||||
self.module = module
|
||||
self.is_lazy = is_lazy
|
||||
|
||||
|
||||
class Nonlocal(stmt):
|
||||
|
||||
Reference in New Issue
Block a user