gitalong.functions module

is_binary_file(filename: str) bool[source]
Parameters

filename (str) – The path to the file to analyze.

Returns

bool – Whether the file is a binary.

is_binary_string(string: str) bool[source]
Parameters

string (str) – A string to analyze.

Returns

bool – Whether the string is a binary string.

is_read_only(filename: str) bool[source]

TODO: Make sure this works on other operating system than Windows.

Parameters

filename (str) – The absolute filename of the file to check.

Returns

bool – Whether the file is read only.

set_read_only(filename: str, read_only: bool = True, check_exists: bool = True) bool[source]

Sets the file read-only state.

Parameters
  • filename (str) – The absolute filename of the file we want to set.

  • read_only (bool, optional) – Whether read-only should be true of false.

  • check_exists (bool, optional) – Whether we are guarding from non existing files.

  • Returns – str: Whether the file was set to the provided permission.

get_real_path(filename: str) str[source]
Parameters

filename (str) – The filemame for which we want the real path.

Returns

str – Real path in case this path goes through Windows subst.

pulled_within(repository: git.repo.base.Repo, seconds: float) bool[source]

Summary

Parameters
  • repository (Repo) – The repository to check for.

  • seconds (float) – Time in seconds since last push.

Returns

TYPE – Whether the repository pulled within the time provided.

get_filenames_from_move_string(move_string: str) tuple[source]