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 @@ -2117,4 +2117,21 @@ module DuckTyping {
21172117 * resolved according to the MRO.
21182118 */
21192119 Function getInit ( Class cls ) { result = invokedFunctionFromClassConstruction ( cls , "__init__" ) }
2120+
2121+ /**
2122+ * Holds if `f` overrides a method in a superclass with the same name.
2123+ */
2124+ predicate overridesMethod ( Function f ) {
2125+ exists ( Class cls | f .getScope ( ) = cls | hasMethod ( getADirectSuperclass ( cls ) , f .getName ( ) ) )
2126+ }
2127+
2128+ /**
2129+ * Holds if `f` is a property accessor (decorated with `@property`, `@name.setter`,
2130+ * or `@name.deleter`).
2131+ */
2132+ predicate isPropertyAccessor ( Function f ) {
2133+ exists ( Attribute a | a = f .getADecorator ( ) | a .getName ( ) = "setter" or a .getName ( ) = "deleter" )
2134+ or
2135+ f .getADecorator ( ) .( Name ) .getId ( ) = "property"
2136+ }
21202137}
You can’t perform that action at this time.
0 commit comments