serena.util.file_proxy#


class FileProxy[source]#

Bases: ABC

abstract get_contents()[source]#
Returns:

the contents of the file as a string.

Return type:

str

abstract get_relative_path()[source]#
Returns:

the relative path reported by Serena (actual relative path or encoded external path)

Return type:

str

abstract is_glob_supported()[source]#
Returns:

whether the proxy supports glob filtering based on its relative path

static is_external_path(relative_path)[source]#
Returns:

whether the given relative path is an encoded external path (not a local project file)

Parameters:

relative_path (str)

Return type:

bool

class LocalProjectFileProxy(relative_path, project)[source]#

Bases: FileProxy

Parameters:
  • relative_path (str)

  • project (Project)

get_contents()[source]#
Returns:

the contents of the file as a string.

Return type:

str

get_relative_path()[source]#
Returns:

the relative path reported by Serena (actual relative path or encoded external path)

Return type:

str

is_glob_supported()[source]#
Returns:

whether the proxy supports glob filtering based on its relative path

class JetBrainsFileProxy(relative_path, project)[source]#

Bases: FileProxy

Retrieves the contents of a file from the JetBrains plugin via the plugin client, given its relative path, which may be an external path (e.g., “<ext:FileUtil.class|472e0a13>”)

Parameters:
  • relative_path (str)

  • project (Project)

get_contents()[source]#
Returns:

the contents of the file as a string.

Return type:

str

get_relative_path()[source]#
Returns:

the relative path reported by Serena (actual relative path or encoded external path)

Return type:

str

is_glob_supported()[source]#
Returns:

whether the proxy supports glob filtering based on its relative path