mirror of
https://github.com/github/codeql.git
synced 2026-04-28 02:05:14 +02:00
Initial commit of Python queries and QL libraries.
This commit is contained in:
committed by
Mark Shannon
parent
90c75cd362
commit
5f58824d1b
42
python/ql/src/Classes/PropertyInOldStyleClass.py
Normal file
42
python/ql/src/Classes/PropertyInOldStyleClass.py
Normal file
@@ -0,0 +1,42 @@
|
||||
|
||||
class OldStyle:
|
||||
|
||||
def __init__(self, x):
|
||||
self._x = x
|
||||
|
||||
# Incorrect: 'OldStyle' is not a new-style class and '@property' is not supported
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
|
||||
|
||||
class InheritOldStyle(OldStyle):
|
||||
|
||||
def __init__(self, x):
|
||||
self._x = x
|
||||
|
||||
# Incorrect: 'InheritOldStyle' is not a new-style class and '@property' is not supported
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
|
||||
|
||||
class NewStyle(object):
|
||||
|
||||
def __init__(self, x):
|
||||
self._x = x
|
||||
|
||||
# Correct: 'NewStyle' is a new-style class and '@property' is supported
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
|
||||
class InheritNewStyle(NewStyle):
|
||||
|
||||
def __init__(self, x):
|
||||
self._x = x
|
||||
|
||||
# Correct: 'InheritNewStyle' inherits from a new-style class and '@property' is supported
|
||||
@property
|
||||
def x(self):
|
||||
return self._x
|
||||
Reference in New Issue
Block a user