Merge pull request #1840 from markshannon/python-better-hasattribute-handling

Python: Add 'hasAttribute' predicate to ObjectInternal and Value.
This commit is contained in:
Rebecca Valentine
2019-08-28 10:45:44 -07:00
committed by GitHub
13 changed files with 103 additions and 7 deletions

View File

@@ -0,0 +1,2 @@
| decorated_exports.py:3:33:3:45 | Str | The name 'not_defined' is exported by __all__ but is not defined. |
| exports.py:1:57:1:64 | Str | The name 'nosuch' is exported by __all__ but is not defined. |

View File

@@ -0,0 +1 @@
Variables/UndefinedExport.ql

View File

@@ -4,3 +4,5 @@
| UndefinedGlobal.py:123:5:123:7 | ug3 | This use of global variable 'ug3' may be undefined. |
| UninitializedLocal.py:5:13:5:15 | ug1 | This use of global variable 'ug1' may be undefined. |
| UninitializedLocal.py:22:9:22:11 | ug1 | This use of global variable 'ug1' may be undefined. |
| decorated_exports.py:10:2:10:19 | undotted_decorator | This use of global variable 'undotted_decorator' may be undefined. |
| decorated_exports.py:14:2:14:13 | not_imported | This use of global variable 'not_imported' may be undefined. |

View File

@@ -0,0 +1,16 @@
import dotted
__all__ = ["foo", "bar", "baz", "not_defined"]
@dotted.decorator
def foo():
pass
@undotted_decorator
def bar():
pass
@not_imported.but_dotted
def baz():
pass

View File

@@ -0,0 +1,19 @@
__all__ = ["foo", "bar", "baz", "quux", "blat", "frob", "nosuch", "i_got_it_elsewhere"]
with open("foo.txt") as f:
foo = f.read()
b = open("bar.txt")
bar = b.read()
baz = open("baz.txt")
from unknown_module import unknown_value
quux = 5 + unknown_value
blat = str(5)
frob = "5"
from unknown_module import i_got_it_elsewhere

View File

@@ -0,0 +1,3 @@
__all__ = ["foo"]
from unknown_module import *