_importdb module

pyflyby._importdb._ancestors_on_same_partition(filename)

Generate ancestors of filename that exist and are on the same partition as the first existing ancestor of filename.

For example, suppose a partition is mounted on /u/homer; /u is a different partition. Suppose /u/homer/aa exists but /u/homer/aa/bb does not exist. Then:

>>> _ancestors_on_same_partition(Filename("/u/homer/aa/bb/cc")) 
[Filename("/u/homer", Filename("/u/homer/aa")]
Return type:

list of Filename

pyflyby._importdb._expand_tripledots(pathnames, target_dirname)

Expand pathnames of the form ".../foo/bar" as “../../foo/bar”, “../foo/bar”, “./foo/bar” etc., up to the oldest ancestor with the same st_dev.

For example, suppose a partition is mounted on /u/homer; /u is a different partition. Then:

>>> _expand_tripledots(["/foo", ".../tt"], "/u/homer/aa") 
[Filename("/foo"), Filename("/u/homer/tt"), Filename("/u/homer/aa/tt")]
Return type:

list of Filename

pyflyby._importdb._find_etc_dirs()
pyflyby._importdb._get_env_var(env_var_name, default)

Get an environment variable and split on “:”, replacing - with the default.

pyflyby._importdb._get_python_path(env_var_name, default_path, target_dirname)

Expand an environment variable specifying pyflyby input config files.

  • Default to default_path if the environment variable is undefined.

  • Process colon delimiters.

  • Replace “-” with default_path.

  • Expand triple dots.

  • Recursively traverse directories.

Return type:

tuple of Filename s

pyflyby._importdb._get_st_dev(filename)