# eric7.EricUtilities.__init__

Package containing utility modules and functions.

### Global Attributes

_configDir
_escape
_escape_map
_uescape
_uunescape

### Classes

None

### Functions

dataString | Function to generate a formatted size string.
decodeBytes | Function to decode some byte text into a string.
decodeString | Function to decode a string containing Unicode encoded characters.
escape_entities | Function to encode html entities.
escape_uentities | Function to encode html entities.
getConfigDir | Module function to get the name of the directory storing the config data.
html_encode | Function to correctly encode a text for html.
html_udecode | Function to correctly decode a html text to a unicode text.
html_uencode | Function to correctly encode a unicode text for html.
readStringFromStream | Module function to read a string from the given stream.
setConfigDir | Module function to set the name of the directory storing the config data.
strGroup | Function to group a string into sub-strings separated by a separator.
strToQByteArray | Function to convert a Python string into a QByteArray.
toBool | Function to convert a value to bool.
toByteArray | Function to convert a value to a byte array.
toDict | Function to convert a value to a dictionary.
toList | Function to convert a value to a list.
unescape_uentities | Function to decode html entities.
versionIsValid | Function to check, if the given version string is valid.
versionToTuple | Function to convert a version string into a tuple.

## dataString

dataString(size, loc=None)

Function to generate a formatted size string.

size (int)
  size to be formatted
loc (QLocale (optional))
  locale to be used for localized size strings (defaults to None)

Return:
  formatted data string

Return Type:
  str

Up

## decodeBytes

decodeBytes(buffer)

Function to decode some byte text into a string.

buffer (bytes)
  byte buffer to decode

Return:
  decoded text

Return Type:
  str

Up

## decodeString

decodeString(text)

Function to decode a string containing Unicode encoded characters.

text (str)
  text containing encoded chars

Return:
  decoded text

Return Type:
  str

Up

## escape_entities

escape_entities(m, escmap=_escape_map)

Function to encode html entities.

m (re.Match)
  the match object
escmap (dict)
  the map of entities to encode

Return:
  the converted text

Return Type:
  str

Up

## escape_uentities

escape_uentities(m)

Function to encode html entities.

m (re.Match)
  the match object

Return:
  the converted text

Return Type:
  str

Up

## getConfigDir

getConfigDir()

Module function to get the name of the directory storing the config data.

Return:
  directory name of the config dir

Return Type:
  str

Up

## html_encode

html_encode(text, pattern=_escape)

Function to correctly encode a text for html.

text (str)
  text to be encoded
pattern (str)
  search pattern for text to be encoded

Return:
  the encoded text

Return Type:
  str

Up

## html_udecode

html_udecode(text, pattern=_uunescape)

Function to correctly decode a html text to a unicode text.

text (str)
  text to be decoded
pattern (str)
  search pattern for text to be decoded

Return:
  the decoded text

Return Type:
  str

Up

## html_uencode

html_uencode(text, pattern=_uescape)

Function to correctly encode a unicode text for html.

text (str)
  text to be encoded
pattern (str)
  search pattern for text to be encoded

Return:
  the encoded text

Return Type:
  str

Up

## readStringFromStream

readStringFromStream(stream)

Module function to read a string from the given stream.

stream (QDataStream)
  data stream opened for reading

Return:
  string read from the stream

Return Type:
  str

Up

## setConfigDir

setConfigDir(d)

Module function to set the name of the directory storing the config data.

d (str)
  name of an existing directory

Up

## strGroup

strGroup(txt, sep, groupLen=4)

Function to group a string into sub-strings separated by a separator.

txt (str)
  text to be grouped
sep (str)
  separator string
groupLen (int)
  length of each group

Return:
  result string

Return Type:
  str

Up

## strToQByteArray

strToQByteArray(txt)

Function to convert a Python string into a QByteArray.

txt (str, bytes, bytearray)
  Python string to be converted

Return:
  converted QByteArray

Return Type:
  QByteArray

Up

## toBool

toBool(value)

Function to convert a value to bool.

value (str)
  value to be converted

Return:
  converted data

Return Type:
  bool

Up

## toByteArray

toByteArray(value)

Function to convert a value to a byte array.

value (QByteArray or None)
  value to be converted

Return:
  converted data

Return Type:
  QByteArray

Up

## toDict

toDict(value)

Function to convert a value to a dictionary.

value (dict or None)
  value to be converted

Return:
  converted data

Return Type:
  dict

Up

## toList

toList(value)

Function to convert a value to a list.

value (None, list or Any)
  value to be converted

Return:
  converted data

Return Type:
  list

Up

## unescape_uentities

unescape_uentities(m)

Function to decode html entities.

m (re.Match)
  the match object

Return:
  the converted text

Return Type:
  str

Up

## versionIsValid

versionIsValid(version)

Function to check, if the given version string is valid.

version (str)
  version string

Return:
  flag indicating validity

Return Type:
  bool

Up

## versionToTuple

versionToTuple(version)

Function to convert a version string into a tuple.

Note: A version string consists of non-negative decimals separated by "." optionally followed by a suffix. Suffix is everything after the last decimal.

version (str)
  version string

Return:
  version named tuple containing the version parts

Return Type:
  semver.VersionInfo

Up