Package org.sonar.python.checks.utils
Class Expressions
java.lang.Object
org.sonar.python.checks.utils.Expressions
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainsSpreadOperator(List<Argument> arguments) static List<Expression>expressionsFromListOrTuple(Expression expression) getAssignedName(Expression expression) static List<Expression>static Optional<Expression>ifNameGetSingleAssignedNonNameValue(Expression expression) static booleanisFalsy(Expression expression) static booleanisGenericTypeAnnotation(Expression expression) static booleanisTruthy(Expression expression) static ExpressionremoveParentheses(Expression expression) static Optional<Expression>static ExpressionsingleAssignedValue(Name name) static ExpressionsingleAssignedValue(Name name, Set<Name> visited) static Stringunescape(StringElement stringElement) static Stringunescape(StringLiteral stringLiteral) static StringunescapeString(String value, boolean isBytesLiteral)
-
Method Details
-
isFalsy
-
isTruthy
-
singleAssignedValue
-
singleAssignedValue
-
removeParentheses
-
singleAssignedNonNameValue
-
ifNameGetSingleAssignedNonNameValue
-
expressionsFromListOrTuple
-
unescape
- Returns:
- concatenation of all underlying StringElement text values without quotes and with escape sequences replacement.
- See Also:
-
unescape
- Returns:
- the string content of the given StringElement text values without quotes and with escape sequences replacement.
- See Also:
-
unescapeString
- Parameters:
value- to unescape according to python string and bytes literals conventionsisBytesLiteral- knowing if it's a string, or an array of bytes is important because python string uses 16 bits characters and support backslash u and U escape sequences'a' == 'a'python bytes array uses 8 bits values and does not support and unescape backslash u and U escape sequencesb'a' != b'a'b'a' == b'\\u0061'- Returns:
- unescaped value
-
getAssignedName
-
getExpressionsFromRhs
-
isGenericTypeAnnotation
-
containsSpreadOperator
-