reuse.vcs module

This module deals with version control systems.

class reuse.vcs.VCSStrategy(project: Project)[source]

Bases: abc.ABC

Strategy pattern for version control systems.

abstract classmethod find_root(cwd: Optional[os.PathLike] = None) Optional[pathlib.Path][source]

Try to find the root of the project from cwd. If none is found, return None.

Raises

NotADirectoryError – if directory is not a directory.

abstract classmethod in_repo(directory: os.PathLike) bool[source]

Is directory inside of the VCS repository?

Raises

NotADirectoryError – if directory is not a directory.

abstract is_ignored(path: os.PathLike) bool[source]

Is path ignored by the VCS?

class reuse.vcs.VCSStrategyGit(project)[source]

Bases: reuse.vcs.VCSStrategy

Strategy that is used for Git.

classmethod find_root(cwd: Optional[os.PathLike] = None) Optional[pathlib.Path][source]

Try to find the root of the project from cwd. If none is found, return None.

Raises

NotADirectoryError – if directory is not a directory.

classmethod in_repo(directory: os.PathLike) bool[source]

Is directory inside of the VCS repository?

Raises

NotADirectoryError – if directory is not a directory.

is_ignored(path: os.PathLike) bool[source]

Is path ignored by the VCS?

class reuse.vcs.VCSStrategyHg(project: Project)[source]

Bases: reuse.vcs.VCSStrategy

Strategy that is used for Mercurial.

classmethod find_root(cwd: Optional[os.PathLike] = None) Optional[pathlib.Path][source]

Try to find the root of the project from cwd. If none is found, return None.

Raises

NotADirectoryError – if directory is not a directory.

classmethod in_repo(directory: os.PathLike) bool[source]

Is directory inside of the VCS repository?

Raises

NotADirectoryError – if directory is not a directory.

is_ignored(path: os.PathLike) bool[source]

Is path ignored by the VCS?

class reuse.vcs.VCSStrategyNone(project: Project)[source]

Bases: reuse.vcs.VCSStrategy

Strategy that is used when there is no VCS.

classmethod find_root(cwd: Optional[os.PathLike] = None) Optional[pathlib.Path][source]

Try to find the root of the project from cwd. If none is found, return None.

Raises

NotADirectoryError – if directory is not a directory.

classmethod in_repo(directory: os.PathLike) bool[source]

Is directory inside of the VCS repository?

Raises

NotADirectoryError – if directory is not a directory.

is_ignored(path: os.PathLike) bool[source]

Is path ignored by the VCS?

reuse.vcs.find_root(cwd: Optional[os.PathLike] = None) Optional[pathlib.Path][source]

Try to find the root of the project from cwd. If none is found, return None.

Raises

NotADirectoryError – if directory is not a directory.