Skip to content

Commit e6425bb

Browse files
committed
Python: Add deprecated keyword to deprecated functions
1 parent c79d7ac commit e6425bb

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

python/ql/src/semmle/python/Files.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ class File extends Container {
99
}
1010

1111
/** DEPRECATED: Use `getAbsolutePath` instead. */
12-
override string getName() {
12+
deprecated override string getName() {
1313
files(this, result, _, _, _)
1414
}
1515

1616
/** DEPRECATED: Use `getAbsolutePath` instead. */
17-
string getFullName() {
17+
deprecated string getFullName() {
1818
result = getName()
1919
}
2020

@@ -97,12 +97,12 @@ class Folder extends Container {
9797
}
9898

9999
/** DEPRECATED: Use `getAbsolutePath` instead. */
100-
override string getName() {
100+
deprecated override string getName() {
101101
folders(this, result, _)
102102
}
103103

104104
/** DEPRECATED: Use `getBaseName` instead. */
105-
string getSimple() {
105+
deprecated string getSimple() {
106106
folders(this, _, result)
107107
}
108108

python/ql/src/semmle/python/Flow.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ class SubscriptNode extends ControlFlowNode {
606606

607607
/** DEPRECATED: Use `getObject()` instead.
608608
* This will be formally deprecated before the end 2018 and removed in 2019.*/
609-
ControlFlowNode getValue() {
609+
deprecated ControlFlowNode getValue() {
610610
exists(Subscript s | this.getNode() = s and s.getObject() = result.getNode() and
611611
result.getBasicBlock().dominates(this.getBasicBlock()))
612612
}

python/ql/src/semmle/python/dataflow/Configuration.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ module TaintTracking {
123123
/* Old query API */
124124

125125
/* deprecated */
126-
predicate hasFlow(Source src, Sink sink) {
126+
deprecated predicate hasFlow(Source src, Sink sink) {
127127
exists(PathSource psrc, PathSink psink |
128128
this.hasFlowPath(psrc, psink) and
129129
src = psrc.getNode().asCfgNode() and

python/ql/src/semmle/python/dataflow/TaintTracking.qll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ abstract class TaintKind extends string {
132132
* This predicate is present for completeness. It is unlikely that any `TaintKind`
133133
* implementation will ever need to override it.
134134
*/
135-
predicate additionalFlowStepVar(EssaVariable fromvar, EssaVariable tovar) { none() }
135+
deprecated predicate additionalFlowStepVar(EssaVariable fromvar, EssaVariable tovar) { none() }
136136

137137
/** Holds if this kind of taint "taints" `expr`.
138138
*/
@@ -143,7 +143,7 @@ abstract class TaintKind extends string {
143143
}
144144

145145
/** DEPRECATED -- Use getType() instead */
146-
ClassObject getClass() {
146+
deprecated ClassObject getClass() {
147147
none()
148148
}
149149

@@ -380,7 +380,7 @@ abstract class Sanitizer extends string {
380380
* Examples include flow from a request to untrusted part of that request or
381381
* from a socket to data from that socket.
382382
*/
383-
abstract class TaintFlow extends string {
383+
deprecated abstract class TaintFlow extends string {
384384

385385
bindingset[this]
386386
TaintFlow() { any() }

python/ql/src/semmle/python/types/FunctionObject.qll

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -381,52 +381,52 @@ class BuiltinFunctionObject extends BuiltinCallable {
381381
}
382382

383383
/** DEPRECATED -- Use `Object::builtin("apply")` instead. */
384-
Object theApplyFunction() {
384+
deprecated Object theApplyFunction() {
385385
result = Object::builtin("apply")
386386
}
387387

388388
/** DEPRECATED -- Use `Object::builtin("hasattr")` instead. */
389-
Object theHasattrFunction() {
389+
deprecated Object theHasattrFunction() {
390390
result = Object::builtin("hasattr")
391391
}
392392

393393
/** DEPRECATED -- Use `Object::builtin("len")` instead. */
394-
Object theLenFunction() {
394+
deprecated Object theLenFunction() {
395395
result = Object::builtin("len")
396396
}
397397

398398
/** DEPRECATED -- Use `Object::builtin("format")` instead. */
399-
Object theFormatFunction() {
399+
deprecated Object theFormatFunction() {
400400
result = Object::builtin("format")
401401
}
402402

403403
/** DEPRECATED -- Use `Object::builtin("open")` instead. */
404-
Object theOpenFunction() {
404+
deprecated Object theOpenFunction() {
405405
result = Object::builtin("open")
406406
}
407407

408408
/** DEPRECATED -- Use `Object::builtin("print")` instead. */
409-
Object thePrintFunction() {
409+
deprecated Object thePrintFunction() {
410410
result = Object::builtin("print")
411411
}
412412

413413
/** DEPRECATED -- Use `Object::builtin("input")` instead. */
414-
Object theInputFunction() {
414+
deprecated Object theInputFunction() {
415415
result = Object::builtin("input")
416416
}
417417

418418
/** DEPRECATED -- Use `Object::builtin("locals")` instead. */
419-
Object theLocalsFunction() {
419+
deprecated Object theLocalsFunction() {
420420
result = Object::builtin("locals")
421421
}
422422

423423
/** DEPRECATED -- Use `Object::builtin("globals")()` instead. */
424-
Object theGlobalsFunction() {
424+
deprecated Object theGlobalsFunction() {
425425
result = Object::builtin("globals")
426426
}
427427

428428
/** DEPRECATED -- Use `Object::builtin("sysExit()` instead. */
429-
Object theExitFunctionObject() {
429+
deprecated Object theExitFunctionObject() {
430430
result = ModuleObject::named("sys").attr("exit")
431431
}
432432

0 commit comments

Comments
 (0)