# eric5.UtilitiesPython2.Tools

Module implementing tool functions.

### Global Attributes

coding_regexps

### Classes

None

### Functions

decode | Function to decode a text.
extractLineFlags | Function to extract flags starting and ending with '__' from a line comment.
get_coding | Function to get the coding of a text.
normalizeCode | Function to normalize the given code.
readEncodedFile | Function to read a file and decode its contents into proper text.

## decode

decode(text)

Function to decode a text.

text
  text to decode (string)

Returns:
  decoded text and encoding

Up

## extractLineFlags

extractLineFlags(line, startComment=")

Function to extract flags starting and ending with '__' from a line comment.

line
  line to extract flags from (string)
startComment=
  string identifying the start of the comment (string)
endComment=
  string identifying the end of a comment (string)

Returns:
  list containing the extracted flags (list of strings)

Up

## get_coding

get_coding(text)

Function to get the coding of a text.

text
  text to inspect (string)

Returns:
  coding string

Up

## normalizeCode

normalizeCode(codestring)

Function to normalize the given code.

codestring
  code to be normalized (string)

Returns:
  normalized code (string)

Up

## readEncodedFile

readEncodedFile(filename)

Function to read a file and decode its contents into proper text.

filename
  name of the file to read (string)

Returns:
  tuple of decoded text and encoding (string, string)

Up