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 @@ -2096,4 +2096,21 @@ module DuckTyping {
20962096 * resolved according to the MRO.
20972097 */
20982098 Function getInit ( Class cls ) { result = invokedFunctionFromClassConstruction ( cls , "__init__" ) }
2099+
2100+ /**
2101+ * Holds if `f` overrides a method in a superclass with the same name.
2102+ */
2103+ predicate overridesMethod ( Function f ) {
2104+ exists ( Class cls | f .getScope ( ) = cls | hasMethod ( getADirectSuperclass ( cls ) , f .getName ( ) ) )
2105+ }
2106+
2107+ /**
2108+ * Holds if `f` is a property accessor (decorated with `@property`, `@name.setter`,
2109+ * or `@name.deleter`).
2110+ */
2111+ predicate isPropertyAccessor ( Function f ) {
2112+ exists ( Attribute a | a = f .getADecorator ( ) | a .getName ( ) = "setter" or a .getName ( ) = "deleter" )
2113+ or
2114+ f .getADecorator ( ) .( Name ) .getId ( ) = "property"
2115+ }
20992116}
You can’t perform that action at this time.
0 commit comments