The Understand Python API gives scripts access to everything Understand knows about your code — entities, references, metrics, and dependencies — and powers custom checks, graphs, and reports.

understand#

Methods Summary

checksum

Return a checksum of the text

deregisterlicensecode

Deregister the current Understand license code.

license

Set the STIHOME directory/path used to locate licensing configuration.

open

Open a database from the passed in filename.

setlicensecode

Set an Understand license code.

version

Return the current version (Major and Minor) and the build number for this module separated by '.'

Methods Documentation

understand.checksum(text, len=32) str#

Return a checksum of the text

Parameters:
  • text (str) – the text to checksum

  • len (int) – optional, the length of the checksum. This should be a value between 1 and 32, and defaults to 32.

Return type:

str

Returns:

the checksum

understand.deregisterlicensecode()#

Deregister the current Understand license code.

Return type:

None

understand.license(name) None#

Set the STIHOME directory/path used to locate licensing configuration. To set an actual license code, use understand.setlicensecode() instead.

Parameters:

name (str) – path to the STIHOME / license configuration directory.

Return type:

None

understand.open(dbname) understand.Db#

Open a database from the passed in filename.

Parameters:

dbname (str) – the filename of the database

Return type:

understand.Db

Returns:

An opened database

Raises:

Understand.Error – if unable to open the database

Possible causes for error are:

  • DBAlreadyOpen - only one database may be open at once

  • DBCorrupt - bad database file

  • DBOldVersion - database needs to be rebuilt

  • DBUnknownVersion - database needs to be rebuilt

  • DBUnableOpen - database is unreadable or does not exist

  • NoApiLicense - Understand license required

understand.setlicensecode(name) None#

Set an Understand license code.

Parameters:

name (str) – the license code.

Return type:

None

understand.version() str#

Return the current version (Major and Minor) and the build number for this module separated by ‘.’

Return type:

str

Returns:

the current version and build number