reuse.vcs module#

This module deals with version control systems.

class reuse.vcs.VCSStrategy(project)[source]#

Bases: ABC

Strategy pattern for version control systems.

abstract classmethod find_root(cwd=None)[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.

Return type:

Optional[Path]

abstract classmethod in_repo(directory)[source]#

Is directory inside of the VCS repository?

Raises:

NotADirectoryError – if directory is not a directory.

Return type:

bool

abstract is_ignored(path)[source]#

Is path ignored by the VCS?

Return type:

bool

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

Bases: VCSStrategy

Strategy that is used for Git.

classmethod find_root(cwd=None)[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.

Return type:

Optional[Path]

classmethod in_repo(directory)[source]#

Is directory inside of the VCS repository?

Raises:

NotADirectoryError – if directory is not a directory.

Return type:

bool

is_ignored(path)[source]#

Is path ignored by the VCS?

Return type:

bool

class reuse.vcs.VCSStrategyHg(project)[source]#

Bases: VCSStrategy

Strategy that is used for Mercurial.

classmethod find_root(cwd=None)[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.

Return type:

Optional[Path]

classmethod in_repo(directory)[source]#

Is directory inside of the VCS repository?

Raises:

NotADirectoryError – if directory is not a directory.

Return type:

bool

is_ignored(path)[source]#

Is path ignored by the VCS?

Return type:

bool

class reuse.vcs.VCSStrategyNone(project)[source]#

Bases: VCSStrategy

Strategy that is used when there is no VCS.

classmethod find_root(cwd=None)[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.

Return type:

Optional[Path]

classmethod in_repo(directory)[source]#

Is directory inside of the VCS repository?

Raises:

NotADirectoryError – if directory is not a directory.

Return type:

bool

is_ignored(path)[source]#

Is path ignored by the VCS?

Return type:

bool

reuse.vcs.find_root(cwd=None)[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.

Return type:

Optional[Path]