delete all deprecations that are over 14 months old

This commit is contained in:
Erik Krogh Kristensen
2022-03-09 18:28:07 +01:00
parent ef07aaa998
commit a86f0afb3c
99 changed files with 1 additions and 3412 deletions

View File

@@ -85,12 +85,6 @@ class ClassDef extends Assign {
/** The scope of a class. This is the scope of all the statements within the class definition */
class Class extends Class_, Scope, AstNode {
/**
* Use getADecorator() instead of getDefinition().getADecorator()
* Use getMetaClass() instead of getDefinition().getMetaClass()
*/
deprecated ClassExpr getDefinition() { result = this.getParent() }
/** Gets a defined init method of this class */
Function getInitMethod() { result.getScope() = this and result.isInitMethod() }

View File

@@ -30,9 +30,6 @@ class Expr extends Expr_, AstNode {
/** Whether this expression is a constant */
predicate isConstant() { not this.isVariable() }
/** Use isParenthesized instead. */
deprecated override predicate isParenthesised() { this.isParenthesized() }
/** Whether the parenthesized property of this expression is true. */
predicate isParenthesized() { Expr_.super.isParenthesised() }
@@ -49,9 +46,6 @@ class Expr extends Expr_, AstNode {
/** Gets an immediate (non-nested) sub-expression of this expression */
Expr getASubExpression() { none() }
/** Use StrConst.getText() instead */
deprecated string strValue() { none() }
override AstNode getAChildNode() { result = this.getASubExpression() }
/**
@@ -622,8 +616,6 @@ class StrConst extends Str_, ImmutableLiteral {
)
}
deprecated override string strValue() { result = this.getS() }
override Expr getASubExpression() { none() }
override AstNode getAChildNode() { result = this.getAnImplicitlyConcatenatedPart() }

View File

@@ -2,12 +2,6 @@ import python
/** A file */
class File extends Container, @file {
/** DEPRECATED: Use `getAbsolutePath` instead. */
deprecated override string getName() { result = this.getAbsolutePath() }
/** DEPRECATED: Use `getAbsolutePath` instead. */
deprecated string getFullName() { result = this.getAbsolutePath() }
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
@@ -115,9 +109,6 @@ private predicate occupied_line(File f, int n) {
/** A folder (directory) */
class Folder extends Container, @folder {
/** DEPRECATED: Use `getAbsolutePath` instead. */
deprecated override string getName() { result = this.getAbsolutePath() }
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
@@ -156,9 +147,6 @@ class Folder extends Container, @folder {
abstract class Container extends @container {
Container getParent() { containerparent(result, this) }
/** Gets a child of this container */
deprecated Container getChild() { containerparent(this, result) }
/**
* Gets a textual representation of the path of this container.
*

View File

@@ -82,30 +82,12 @@ class ControlFlowNode extends @py_flow_node {
toAst(this) instanceof NameConstant
}
/** Use NameNode.isLoad() instead */
deprecated predicate isUse() { toAst(this) instanceof Name and this.isLoad() }
/** Use NameNode.isStore() */
deprecated predicate isDefinition() { toAst(this) instanceof Name and this.isStore() }
/** Whether this flow node corresponds to an attribute expression */
predicate isAttribute() { toAst(this) instanceof Attribute }
/** Use AttrNode.isLoad() instead */
deprecated predicate isAttributeLoad() { toAst(this) instanceof Attribute and this.isLoad() }
/** Use AttrNode.isStore() instead */
deprecated predicate isAttributeStore() { toAst(this) instanceof Attribute and this.isStore() }
/** Whether this flow node corresponds to an subscript expression */
predicate isSubscript() { toAst(this) instanceof Subscript }
/** Use SubscriptNode.isLoad() instead */
deprecated predicate isSubscriptLoad() { toAst(this) instanceof Subscript and this.isLoad() }
/** Use SubscriptNode.isStore() instead */
deprecated predicate isSubscriptStore() { toAst(this) instanceof Subscript and this.isStore() }
/** Whether this flow node corresponds to an import member */
predicate isImportMember() { toAst(this) instanceof ImportMember }
@@ -439,12 +421,6 @@ class AttrNode extends ControlFlowNode {
)
}
/** Use getObject() instead */
deprecated ControlFlowNode getValue() { result = this.getObject() }
/** Use getObject(name) instead */
deprecated ControlFlowNode getValue(string name) { result = this.getObject(name) }
/**
* Gets the flow node corresponding to the object of the attribute expression corresponding to this flow node,
* with the matching name
@@ -507,18 +483,6 @@ class ImportStarNode extends ControlFlowNode {
class SubscriptNode extends ControlFlowNode {
SubscriptNode() { toAst(this) instanceof Subscript }
/**
* DEPRECATED: Use `getObject()` instead.
* This will be formally deprecated before the end 2018 and removed in 2019.
*/
deprecated ControlFlowNode getValue() {
exists(Subscript s |
this.getNode() = s and
s.getObject() = result.getNode() and
result.getBasicBlock().dominates(this.getBasicBlock())
)
}
/** flow node corresponding to the value of the sequence in a subscript operation */
ControlFlowNode getObject() {
exists(Subscript s |
@@ -950,10 +914,6 @@ class NameNode extends ControlFlowNode {
/** A control flow node corresponding to a named constant, one of `None`, `True` or `False`. */
class NameConstantNode extends NameNode {
NameConstantNode() { exists(NameConstant n | py_flow_bb_node(this, n, _, _)) }
deprecated override predicate defines(Variable v) { none() }
deprecated override predicate deletes(Variable v) { none() }
/*
* We ought to override uses as well, but that has
* a serious performance impact.

View File

@@ -167,13 +167,6 @@ class Import extends Import_ {
result = this.getAName().getValue().(ImportMember).getModule()
}
/**
* Use getAnImportedModuleName(),
* possibly combined with ModuleObject.importedAs()
* Gets a module imported by this import statement
*/
deprecated Module getAModule() { result.getName() = this.getAnImportedModuleName() }
/** Whether this a `from ... import ...` statement */
predicate isFromImport() { this.getAName().getValue() instanceof ImportMember }
@@ -218,13 +211,6 @@ class ImportStar extends ImportStar_ {
override string toString() { result = "from " + this.getModuleExpr().getName() + " import *" }
/**
* Use getAnImportedModuleName(),
* possibly combined with ModuleObject.importedAs()
* Gets the module imported by this import * statement
*/
deprecated Module getTheModule() { result.getName() = this.getImportedModuleName() }
override Expr getASubExpression() { result = this.getModule() }
override Stmt getASubStatement() { none() }

View File

@@ -99,12 +99,6 @@ class Module extends Module_, Scope, AstNode {
/** Gets the metrics for this module */
ModuleMetrics getMetrics() { result = this }
/**
* Use ModuleObject.getAnImportedModule() instead.
* Gets a module imported by this module
*/
deprecated Module getAnImportedModule() { result.getName() = this.getAnImportedModuleName() }
string getAnImportedModuleName() {
exists(Import i | i.getEnclosingModule() = this | result = i.getAnImportedModuleName())
or

View File

@@ -121,14 +121,6 @@ module TaintTracking {
/* Old query API */
/* deprecated */
deprecated predicate hasFlow(Source src, Sink sink) {
exists(PathSource psrc, PathSink psink |
this.hasFlowPath(psrc, psink) and
src = psrc.getNode().asCfgNode() and
sink = psink.getNode().asCfgNode()
)
}
/* New query API */
predicate hasSimpleFlow(DataFlow::Node src, DataFlow::Node sink) {
exists(PathSource psrc, PathSink psink |

View File

@@ -3,22 +3,6 @@ private import semmle.python.objects.ObjectInternal
import semmle.python.dataflow.Implementation
/* For backwards compatibility -- Use `TaintTrackingContext` instead. */
deprecated class CallContext extends TaintTrackingContext {
TaintTrackingContext getCallee(CallNode call) { result.getCaller(call) = this }
predicate appliesToScope(Scope s) {
exists(PythonFunctionObjectInternal func, TaintKind param, AttributePath path, int n |
this = TParamContext(param, path, n) and
exists(TaintTrackingImplementation impl |
impl.callWithTaintedArgument(_, _, _, func, n, path, param) and
s = func.getScope()
)
)
or
this.isTop() and exists(s)
}
}
/* Backwards compatibility with config-less taint-tracking */
private class LegacyConfiguration extends TaintTracking::Configuration {
LegacyConfiguration() {

View File

@@ -138,9 +138,6 @@ abstract class TaintKind extends string {
exists(TaintedNode n | n.getTaintKind() = this and n.getCfgNode() = expr)
}
/** DEPRECATED -- Use getType() instead */
deprecated ClassObject getClass() { none() }
/**
* Gets the class of this kind of taint.
* For example, if this were a kind of string taint
@@ -613,32 +610,6 @@ module DataFlow {
*/
class Extension = DataFlowExtension::DataFlowNode;
abstract deprecated class Configuration extends string {
bindingset[this]
Configuration() { this = this }
abstract predicate isSource(ControlFlowNode source);
abstract predicate isSink(ControlFlowNode sink);
private predicate hasFlowPath(TaintedNode source, TaintedNode sink) {
source.getConfiguration() = this and
this.isSource(source.getCfgNode()) and
this.isSink(sink.getCfgNode()) and
source.flowsTo(sink)
}
predicate hasFlow(ControlFlowNode source, ControlFlowNode sink) {
exists(TaintedNode psource, TaintedNode psink |
psource.getCfgNode() = source and
psink.getCfgNode() = sink and
this.isSource(source) and
this.isSink(sink) and
this.hasFlowPath(psource, psink)
)
}
}
deprecated private class ConfigurationAdapter extends TaintTracking::Configuration instanceof Configuration {
override predicate isSource(DataFlow::Node node, TaintKind kind) {
Configuration.super.isSource(node.asCfgNode()) and
@@ -670,9 +641,6 @@ module DataFlow {
abstract Location getLocation();
AstNode asAstNode() { result = this.asCfgNode().getNode() }
/** For backwards compatibility -- Use asAstNode() instead */
deprecated AstNode getNode() { result = this.asAstNode() }
}
class CfgNode extends Node, TCfgNode {
@@ -708,13 +676,6 @@ module DataFlow {
}
}
deprecated private class DataFlowType extends TaintKind {
DataFlowType() {
this = "Data flow" and
exists(DataFlow::Configuration c)
}
}
pragma[noinline]
private predicate dict_construct(ControlFlowNode itemnode, ControlFlowNode dictnode) {
dictnode.(DictNode).getAValue() = itemnode

View File

@@ -495,11 +495,7 @@ private EssaVariable potential_input(EssaNodeRefinement ref) {
}
/* For backwards compatibility */
deprecated class PyNodeDefinition = EssaNodeDefinition;
/* For backwards compatibility */
deprecated class PyNodeRefinement = EssaNodeRefinement;
/** An assignment to a variable `v = val` */
class AssignmentDefinition extends EssaNodeDefinition {
AssignmentDefinition() {

View File

@@ -3,26 +3,6 @@
import python
private import semmle.python.pointsto.PointsTo
/** A method that to a sub-class of `zope.interface.Interface` */
deprecated class ZopeInterfaceMethod extends PyFunctionObject {
/** Holds if this method belongs to a class that sub-classes `zope.interface.Interface` */
ZopeInterfaceMethod() {
exists(Object interface, ClassObject owner |
interface = ModuleObject::named("zope.interface").attr("Interface") and
owner.declaredAttribute(_) = this and
owner.getAnImproperSuperType().getABaseType() = interface
)
}
override int minParameters() { result = super.minParameters() + 1 }
override int maxParameters() {
if exists(this.getFunction().getVararg())
then result = super.maxParameters()
else result = super.maxParameters() + 1
}
}
/** A method that belongs to a sub-class of `zope.interface.Interface` */
class ZopeInterfaceMethodValue extends PythonFunctionValue {
/** Holds if this method belongs to a class that sub-classes `zope.interface.Interface` */

View File

@@ -190,17 +190,6 @@ private newtype TIterationDefinition =
SsaSource::iteration_defined_variable(var, def, sequence)
}
/**
* DEPRECATED. For backwards compatibility only.
* A definition of a variable in a for loop `for v in ...:`
*/
deprecated class IterationDefinition extends TIterationDefinition {
/** Gets a textual representation of this element. */
string toString() { result = "IterationDefinition" }
ControlFlowNode getSequence() { this = TIterationDefinition_(_, _, result) }
}
/** Hold if outer contains inner, both are contained within a test and inner is a use is a plain use or an attribute lookup */
pragma[noinline]
predicate contains_interesting_expression_within_test(ControlFlowNode outer, ControlFlowNode inner) {

View File

@@ -1,5 +1,2 @@
/* For backwards compatibility */
import PointsTo::PointsTo as P
/** DEPRECATED: Use `PointsTo` instead */
deprecated module FinalPointsTo = P;

View File

@@ -145,24 +145,6 @@ module PointsTo {
)
}
deprecated predicate ssa_variable_points_to(
EssaVariable var, PointsToContext context, Object obj, ClassObject cls, CfgOrigin origin
) {
exists(ObjectInternal value |
PointsToInternal::variablePointsTo(var, context, value, origin) and
cls = value.getClass().getSource()
|
obj = value.getSource()
)
}
deprecated CallNode get_a_call(Object func, PointsToContext context) {
exists(ObjectInternal value |
result = value.(Value).getACall(context) and
func = value.getSource()
)
}
cached
predicate moduleExports(ModuleObjectInternal mod, string name) {
InterModulePointsTo::moduleExportsBoolean(mod, name) = true

View File

@@ -30,40 +30,7 @@ abstract class PointsToExtension extends @py_flow_node {
* sources of data to the points-to analysis.
*/
/** DEPRECATED -- Use PointsToExtension instead */
abstract deprecated class CustomPointsToFact extends @py_flow_node {
string toString() { result = "CustomPointsToFact with missing toString" }
abstract predicate pointsTo(Context context, Object value, ClassObject cls, ControlFlowNode origin);
}
/** DEPRECATED -- Use PointsToExtension instead */
deprecated class FinalCustomPointsToFact = CustomPointsToFact;
abstract deprecated class CustomPointsToOriginFact extends CustomPointsToFact {
abstract predicate pointsTo(Object value, ClassObject cls);
override predicate pointsTo(Context context, Object value, ClassObject cls, ControlFlowNode origin) {
this.pointsTo(value, cls) and origin = this and context.appliesTo(this)
}
}
/* Custom points-to fact with inferred class */
abstract deprecated class CustomPointsToObjectFact extends CustomPointsToFact {
abstract predicate pointsTo(Object value);
override predicate pointsTo(Context context, Object value, ClassObject cls, ControlFlowNode origin) {
this.pointsTo(value) and cls = simple_types(value) and origin = this and context.appliesTo(this)
}
}
/** DEPRECATED -- Unsupported; do not use */
abstract deprecated class CustomPointsToAttribute extends Object {
abstract predicate attributePointsTo(
string name, Object value, ClassObject cls, ControlFlowNode origin
);
}
/* An example */
/** An extension representing the fact that a variable iterating over range or xrange must be an integer */
class RangeIterationVariableFact extends PointsToExtension {
@@ -164,19 +131,3 @@ deprecated private class BackwardCompatiblePointToExtension extends PointsToExte
)
}
}
deprecated private predicate additionalAttribute(
ObjectInternal owner, string name, ObjectInternal value, ControlFlowNode origin
) {
exists(Object obj, ClassObject cls |
owner.getSource().(CustomPointsToAttribute).attributePointsTo(name, obj, cls, origin)
|
value.getBuiltin() = obj
or
obj instanceof ControlFlowNode and
exists(ClassObjectInternal c |
c.getSource() = cls and
value = TUnknownInstance(c)
)
)
}

View File

@@ -29,9 +29,6 @@ abstract class FunctionObject extends Object {
/** Whether this function raises an exception, the class of which cannot be inferred */
abstract predicate raisesUnknownType();
/** Use descriptiveString() instead. */
deprecated string prettyString() { result = this.descriptiveString() }
/** Gets a longer, more descriptive version of toString() */
abstract string descriptiveString();
@@ -311,33 +308,3 @@ class BuiltinFunctionObject extends BuiltinCallable {
override int maxParameters() { none() }
}
/** DEPRECATED -- Use `Object::builtin("apply")` instead. */
deprecated Object theApplyFunction() { result = Object::builtin("apply") }
/** DEPRECATED -- Use `Object::builtin("hasattr")` instead. */
deprecated Object theHasattrFunction() { result = Object::builtin("hasattr") }
/** DEPRECATED -- Use `Object::builtin("len")` instead. */
deprecated Object theLenFunction() { result = Object::builtin("len") }
/** DEPRECATED -- Use `Object::builtin("format")` instead. */
deprecated Object theFormatFunction() { result = Object::builtin("format") }
/** DEPRECATED -- Use `Object::builtin("open")` instead. */
deprecated Object theOpenFunction() { result = Object::builtin("open") }
/** DEPRECATED -- Use `Object::builtin("print")` instead. */
deprecated Object thePrintFunction() { result = Object::builtin("print") }
/** DEPRECATED -- Use `Object::builtin("input")` instead. */
deprecated Object theInputFunction() { result = Object::builtin("input") }
/** DEPRECATED -- Use `Object::builtin("locals")` instead. */
deprecated Object theLocalsFunction() { result = Object::builtin("locals") }
/** DEPRECATED -- Use `Object::builtin("globals")()` instead. */
deprecated Object theGlobalsFunction() { result = Object::builtin("globals") }
/** DEPRECATED -- Use `Object::builtin("sysExit()` instead. */
deprecated Object theExitFunctionObject() { result = ModuleObject::named("sys").attr("exit") }

View File

@@ -74,13 +74,6 @@ abstract class ModuleObject extends Object {
*/
predicate exports(string name) { this.theModule().exports(name) }
/**
* Whether the complete set of names "exported" by this module can be accurately determined
*
* DEPRECATED: Use ModuleValue::hasCompleteExportInfo instead
*/
abstract deprecated predicate exportsComplete();
/** Gets the short name of the module. For example the short name of module x.y.z is 'z' */
string getShortName() {
result = this.getName().suffix(this.getPackage().getName().length() + 1)
@@ -117,8 +110,6 @@ class BuiltinModuleObject extends ModuleObject {
}
override predicate hasAttribute(string name) { exists(this.asBuiltin().getMember(name)) }
deprecated override predicate exportsComplete() { any() }
}
class PythonModuleObject extends ModuleObject {
@@ -131,18 +122,6 @@ class PythonModuleObject extends ModuleObject {
override Module getSourceModule() { result = this.getOrigin() }
override Container getPath() { result = this.getModule().getFile() }
deprecated override predicate exportsComplete() {
exists(Module m | m = this.getModule() |
not exists(Call modify, Attribute attr, GlobalVariable all |
modify.getScope() = m and
modify.getFunc() = attr and
all.getId() = "__all__"
|
attr.getObject().(Name).uses(all)
)
)
}
}
/**
@@ -196,12 +175,6 @@ class PackageObject extends ModuleObject {
)
}
deprecated override predicate exportsComplete() {
not exists(this.getInitModule())
or
this.getInitModule().exportsComplete()
}
override predicate hasAttribute(string name) {
exists(this.submodule(name))
or

View File

@@ -366,9 +366,6 @@ BuiltinModuleObject theBuiltinModuleObject() { result.asBuiltin() = Builtin::bui
/** Gets the `sys` module */
BuiltinModuleObject theSysModuleObject() { result.asBuiltin() = Builtin::special("sys") }
/** DEPRECATED -- Use `Object::builtin(name)` instead. */
deprecated Object builtin_object(string name) { result = Object::builtin(name) }
/** Gets the built-in object None */
Object theNoneObject() { result.asBuiltin() = Builtin::special("None") }
@@ -390,15 +387,6 @@ Object theIndexErrorType() { result = Object::builtin("IndexError") }
/** Gets the LookupError class */
Object theLookupErrorType() { result = Object::builtin("LookupError") }
/** DEPRECATED -- Use `Object::quitter(name)` instead. */
deprecated Object quitterObject(string name) { result = Object::quitter(name) }
/** DEPRECATED -- Use `Object::notImplemented()` instead. */
deprecated Object theNotImplementedObject() { result = Object::builtin("NotImplemented") }
/** DEPRECATED -- Use `TupleObject::empty()` instead. */
deprecated Object theEmptyTupleObject() { result = TupleObject::empty() }
module Object {
Object builtin(string name) { result.asBuiltin() = Builtin::builtin(name) }

View File

@@ -21,9 +21,6 @@ deprecated class DjangoShortcutsRedirectSink extends HttpRedirectTaintSink {
}
}
/** DEPRECATED: Use `DjangoShortcutsRedirectSink` instead. */
deprecated class DjangoRedirect = DjangoShortcutsRedirectSink;
/**
* The URL argument when instantiating a Django Redirect Response.
*/

View File

@@ -4,16 +4,6 @@ import semmle.python.security.strings.Basic
private import semmle.python.web.django.Shared
private import semmle.python.web.Http
/**
* DEPRECATED: This class is internal to the django library modeling, and should
* never be used by anyone.
*
* A django.http.response.Response object
* This isn't really a "taint", but we use the value tracking machinery to
* track the flow of response objects.
*/
deprecated class DjangoResponse = DjangoResponseKind;
/** INTERNAL class used for tracking a django response object. */
deprecated private class DjangoResponseKind extends TaintKind {
DjangoResponseKind() { this = "django.response.HttpResponse" }

View File

@@ -1,17 +1,5 @@
import python
/** DEPRECATED: Use `Value::named("django.shortcuts.redirect")` instead. */
deprecated FunctionValue redirect() { result = Value::named("django.shortcuts.redirect") }
/** DEPRECATED: Use `DjangoRedirectResponseClass` instead. */
deprecated ClassValue theDjangoHttpRedirectClass() {
// version 1.x
result = Value::named("django.http.response.HttpResponseRedirectBase")
or
// version 2.x
result = Value::named("django.http.HttpResponseRedirectBase")
}
/** A class that is a Django Redirect Response (subclass of `django.http.HttpResponseRedirectBase`). */
deprecated class DjangoRedirectResponseClass extends ClassValue {
DjangoRedirectResponseClass() {

View File

@@ -12,13 +12,6 @@ class XMLLocatable extends @xmllocatable, TXMLLocatable {
/** Gets the source location for this element. */
Location getLocation() { xmllocations(this, result) }
/**
* DEPRECATED: Use `getLocation()` instead.
*
* Gets the source location for this element.
*/
deprecated Location getALocation() { result = this.getLocation() }
/**
* Holds if this element is at the specified location.
* The location spans column `startcolumn` of line `startline` to
@@ -83,21 +76,6 @@ class XMLParent extends @xmlparent {
/** Gets the number of places in the body of this XML parent where text occurs. */
int getNumberOfCharacterSets() { result = count(int pos | xmlChars(_, _, this, pos, _, _)) }
/**
* DEPRECATED: Internal.
*
* Append the character sequences of this XML parent from left to right, separated by a space,
* up to a specified (zero-based) index.
*/
deprecated string charsSetUpTo(int n) {
n = 0 and xmlChars(_, result, this, 0, _, _)
or
n > 0 and
exists(string chars | xmlChars(_, chars, this, n, _, _) |
result = this.charsSetUpTo(n - 1) + " " + chars
)
}
/**
* Gets the result of appending all the character sequences of this XML parent from
* left to right, separated by a space.