File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
python/ql/lib/semmle/python/dataflow/new/internal Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -2061,4 +2061,21 @@ module DuckTyping {
20612061 * resolved according to the MRO.
20622062 */
20632063 Function getInit ( Class cls ) { result = invokedFunctionFromClassConstruction ( cls , "__init__" ) }
2064+
2065+ /**
2066+ * Holds if `f` overrides a method in a superclass with the same name.
2067+ */
2068+ predicate overridesMethod ( Function f ) {
2069+ exists ( Class cls | f .getScope ( ) = cls | hasMethod ( getADirectSuperclass ( cls ) , f .getName ( ) ) )
2070+ }
2071+
2072+ /**
2073+ * Holds if `f` is a property accessor (decorated with `@property`, `@name.setter`,
2074+ * or `@name.deleter`).
2075+ */
2076+ predicate isPropertyAccessor ( Function f ) {
2077+ exists ( Attribute a | a = f .getADecorator ( ) | a .getName ( ) = "setter" or a .getName ( ) = "deleter" )
2078+ or
2079+ f .getADecorator ( ) .( Name ) .getId ( ) = "property"
2080+ }
20642081}
You can’t perform that action at this time.
0 commit comments