Skip to main content

Python

Scopes

Supported facets

These facets are supported

Anonymous function

  • Anonymous function: An anonymous function, eg a lambda function, an arrow function, etc

Argument or parameter

  • Actual: An argument/parameter in a function call
  • Actual constructor: An argument/parameter in a constructor call
  • Actual constructor (iteration): Iteration scope of arguments in a constructor call, should be inside the parens of the argument list
  • Actual (iteration): Iteration scope of arguments in a function call, should be inside the parens of the argument list
  • Actual method: An argument/parameter in a method call
  • Actual method (iteration): Iteration scope of arguments in a method call, should be inside the parens of the argument list
  • Formal: A parameter in a function declaration
  • Formal constructor: A parameter in a constructor declaration
  • Formal constructor (iteration): Iteration scope of the formal parameters of a constructor declaration; should be the whole parameter list. The domain should be the entire function.
  • Formal (iteration): Iteration scope of the formal parameters of a function declaration; should be the whole parameter list. The domain should be the entire function.
  • Formal method: A parameter in a class method declaration
  • Formal method (iteration): Iteration scope of the formal parameters of a class method declaration; should be the whole parameter list. The domain should be the entire function.

Branch

  • If: An if/elif/else branch
  • If (iteration): Iteration scope for if/elif/else branch; should be the entire if-else statement
  • Loop: A for / while loop branch. For most languages there will just be one branch for the entire loop, but eg in Python you can have an else branch for a loop.
  • Switch case: A case/default branch in a switch/match statement
  • Switch case (iteration): Iteration scope for branches in a switch/match statement; should contain all the cases
  • Ternary: A branch in a ternary expression
  • Try: A try/catch/finally branch
  • Try (iteration): Iteration scope for try/catch/finally branch; should be the entire try-catch statement

Class

  • Class: A class in an object-oriented language
  • Iteration document: Iteration scope for classes. The entire document.

Class name

  • Class name: The name of a class
  • Iteration document: Iteration scope for class names. The entire document.

Collection item

  • Unenclosed: An item in a comma-separated list without enclosing delimiters. This could be multi-variable declarations, import statements, etc.
  • Unenclosed (iteration): Iteration scope for items in a comma-separated list without enclosing delimiters

Collection key

  • Map pair: Key (LHS) of a key-value pair of a map
  • Map pair (iteration): Iteration scope of key-value pairs in a map; should be between the braces

Comment

  • Line: A line comment

Condition

  • If: A condition in an if statement
  • Switch case: A condition in a switch statement
  • Switch case (iteration): The iteration scope for conditions in a switch statement: should contain all the cases, and exclude any curly brackets delimiting the full switch statement body
  • Ternary: A condition in a ternary expression
  • While: A condition in a while loop

Disqualify delimiter

  • Disqualify delimiter: Used to disqualify a token from being treated as a surrounding pair delimiter. This will usually be operators containing `>` or `<`, eg `<`, `<=`, `->`, etc

Function call

  • Function call: A function call
  • Constructor: A constructor call

Function callee

  • Function callee: The function being called in a function call
  • Constructor: The class being constructed in a class instantiation, including the `new` keyword

Function name

  • Function name: The name of a function
  • Constructor: The name of a constructor in a class
  • Iteration document: Iteration scope for function names: the entire document
  • Method: The name of a method in a class
  • Method iteration class: Iteration scope for method names: class bodies

If statement

  • If statement: An if statement

Interior

  • Class: The body of a class
  • Function: The body of a function
  • If: The body of an if/elif/else branch
  • Lambda: The body of a lambda/anonymous function
  • Loop: The body of an for/while loop
  • Resource: the body of a 'with' / 'use' / 'using' statement
  • Switch case: The body of an switch case branch
  • Ternary: The body of an ternary condition/branch
  • Try: The body of an try/catch/finally branch

List

  • List: A list/array

Map

  • Map: A map/dictionary

Name

  • Argument actual: The name of a (keyword) argument in a function call
  • Argument actual (iteration): Iteration scope of the names of the actual parameters of a function call; should be the whole arguments list
  • Argument formal: The name of a parameter in a function declaration
  • Argument formal constructor: The name of a parameter in a constructor declaration
  • Argument formal constructor (iteration): Iteration scope of the names of the formal parameters of a constructor declaration; should be the whole parameter list
  • Argument formal (iteration): Iteration scope of the names of the formal parameters of a function declaration; should be the whole parameter list
  • Argument formal method: The name of a parameter in a class method declaration
  • Argument formal method (iteration): Iteration scope of the names of the formal parameters of a class method declaration; should be the whole parameter list
  • Assignment: Name (LHS) of an assignment
  • Assignment pattern: LHS of an assignment with pattern destructuring
  • Class: Name of a class
  • Constructor: Name of a constructor
  • Field: Name (LHS) of a field in a class / interface
  • Foreach: Iteration variable name in a for each loop
  • Function: Name of a function
  • Iteration block: Iteration scope for names: statement blocks (body of functions/if classes/for loops/etc).
  • Iteration document: Iteration scope for names: the entire document
  • Method: Name of a class method
  • Resource: Name in a 'with' / 'use' / 'using' statement
  • Resource (iteration): Iteration scope for names in a 'with' / 'use' / 'using' statement
  • Variable: Name (LHS) of a variable declaration
  • Variable pattern: Name (LHS) of a variable declaration with pattern destructuring

Named function

  • Named function: A named function declaration
  • Constructor: A constructor declaration in a class
  • Iteration document: Iteration scope for named functions: the entire document
  • Method: A named method declaration in a class
  • Method iteration class: Iteration scope for named functions: class bodies

Pair delimiter

  • Pair delimiter: A pair delimiter, eg parentheses, brackets, braces, quotes, etc

Statement

  • Statement: A statement, eg assignment, for loop, etc
  • Class: An class declaration
  • Iteration block: Iteration scope for statements. Statement blocks(body of functions/if statements/for loops/etc).
  • Iteration document: Iteration scope for statements. The entire document.

String

  • Multi line: A multi-line string
  • Single line: A single-line string

Text fragment

  • Comment line: Text fragment consisting of a line comment
  • String multi line: Text fragment consisting of a multi-line string
  • String single line: Text fragment consisting of a single-line string

Value

  • Argument actual: The value of a argument in a function call
  • Argument actual (iteration): Iteration scope of the values of the actual parameters of a function call; should be the whole arguments list
  • Argument formal: The value of a (keyword) argument in a function declaration
  • Argument formal constructor: The value of a parameter in a constructor declaration
  • Argument formal constructor (iteration): Iteration scope of the values of the formal parameters of a constructor declaration; should be the whole parameter list
  • Argument formal (iteration): Iteration scope of the values of the formal parameters of a function declaration; should be the whole parameter list
  • Argument formal method: The value of a parameter in a class method declaration
  • Argument formal method (iteration): Iteration scope of the values of the formal parameters of a class method declaration; should be the whole parameter list
  • Assignment: Value (RHS) of an assignment
  • Field: Value (RHS) of a field in a class / interface
  • Foreach: Iterable in a for each loop
  • Map pair: Value (RHS) of a key-value pair in a map
  • Map pair (iteration): Iteration scope of key-value pairs in a map; should be between the braces
  • Resource: Value of a 'with' / 'use' / 'using' statement
  • Resource (iteration): Iteration scope for values in a 'with' / 'use' / 'using' statement
  • Return: Return value of a function
  • Return lambda: Implicit return value from a lambda
  • Variable: Value (RHS) of a variable declaration
  • Variable pattern: Value (RHS) of a variable declaration with pattern destructuring
  • Yield: Value of a yield statement

Unsupported facets

These facets are not supported yet and needs a developer to implement them

Unspecified facets

These facets are unspecified