mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
53 lines
926 B
Python
53 lines
926 B
Python
|
|
|
|
class BaseClass(object):
|
|
|
|
cls_attr = 0
|
|
|
|
def __init__(self):
|
|
self.shadowing = 2
|
|
|
|
class DerivedClass(BaseClass):
|
|
|
|
cls_attr = 3
|
|
shadowing = 5
|
|
|
|
def __init__(self):
|
|
BaseClass.__init__(self)
|
|
self.inst_attr = 4
|
|
|
|
def method(self):
|
|
self.cls_attr
|
|
self.inst_attr
|
|
self.shadowing
|
|
|
|
#ODASA-3836
|
|
def comprehensions_and_generators(seq):
|
|
[y*y for y in seq]
|
|
(y*y for y in seq)
|
|
{y*y for y in seq}
|
|
{y:y*y for y in seq}
|
|
|
|
#ODASA-5391
|
|
@decorator(x)
|
|
class Decorated(object):
|
|
pass
|
|
|
|
d = Decorated()
|
|
|
|
import module as thing
|
|
from module import foo
|
|
foo
|
|
thing.bar
|
|
|
|
from package import x
|
|
import package as p
|
|
p.x
|
|
|
|
def foo(dirname, lines):
|
|
head, tail = os.path.split(dirname)
|
|
x = head # `head` is missing jump-to-def target
|
|
for start, line in enumerate(lines):
|
|
line = line.strip() # `line` is missing jump-to-def target
|
|
break
|
|
return x |