Skip to content

Service

GithubFileMap

Helper to keep track of which file is related to which metadata.

I.e., the change detector only requires a subset in information, but then we want to be able to identify which file is related to that information.

files = files instance-attribute

github_key_mapping cached property

metadatas cached property

__init__(files)

from_node_identifier(node_identifier)

github_key_from_metadata(metadata) staticmethod

delete_repository(uow, repo_id, user_id) async

Delete all parsed files for a specific repository id.

PARAMETER DESCRIPTION
uow

The unit of work to use for the database operations.

TYPE: AbstractGithubParsingUnitOfWork

repo_id

The owner/repo/branch to get the tree for.

TYPE: RepoID

user_id

ID of user for this repository (or "public").

TYPE: UserID | Literal['public']

get_repository_files(uow, repo_id, user_id, fully_load=False) async

Get all parsed files for a specific repository id.

PARAMETER DESCRIPTION
uow

The unit of work to use for the database operations.

TYPE: AbstractGithubParsingUnitOfWork

repo_id

The owner/repo/branch to get the tree for.

TYPE: RepoID

user_id

ID of user for this repository (or "public").

TYPE: UserID | Literal['public']

fully_load

Whether to fully load the parsed files (i.e. load all nested objects).

TYPE: bool DEFAULT: False

initialize_new_repository(uow, repo_id, user_id, max_size_fill=10000, as_repo_id=None) async

Combine getting repository from github, parsing, and saving to database.

This only applies for a new repository (one that is not already stored in the database).

PARAMETER DESCRIPTION
uow

The unit of work to use for the database operations.

TYPE: AbstractGithubParsingUnitOfWork

repo_id

The owner/repo/branch to get the tree for.

TYPE: RepoID

user_id

ID of user for this repository (or "public" if it's a public repo).

TYPE: UserID | Literal['public']

max_size_fill

If the size of the blob is greater than this (in bytes), don't fill the text

TYPE: int DEFAULT: 10000

as_repo_id

The RepoID to store the updated files as. If None, will use the repo_id.

TYPE: RepoID | None DEFAULT: None

parsed_repo_stats(uow, repo_id, user_id) async

update_repository(uow, repo_id, user_id, max_size_fill=10000, from_repo_id=None, modify_from_repo=False, as_repo_id=None) async

Coordinate the github service and database store of repo to update contents to latest version of repo_id.

I.e., If the repo was previously parsed, but there have been new commits since then, this will make any necessary updates to the database and return information about the changes made.

PARAMETER DESCRIPTION
uow

The unit of work to use for the database operations.

TYPE: AbstractGithubParsingUnitOfWork

repo_id

The owner/repo/branch to get the tree for.

TYPE: RepoID

user_id

ID of user for this repository (or "public" if it's a public repo).

TYPE: UserID | Literal['public']

max_size_fill

Ignore any blobs that are larger than this size (in bytes).

TYPE: int DEFAULT: 10000

from_repo_id

The RepoID to compare against. E.g., A different branch of the same repository, or specific commit hash.

TYPE: RepoID | None DEFAULT: None

modify_from_repo

Whether to change the from_repo_id entries in the database. If from_repo_id references a specific commit on the same branch, this should generally be True (only want to keep the latest version of a branch), but if it references a different branch, it might make sense for this to be false (e.g., use the main branch as a starting point for creating updates for a new branch, but keep the main branch entries)

TYPE: bool DEFAULT: False

as_repo_id

The RepoID to store the updated files as. If None, will use the repo_id.

TYPE: RepoID | None DEFAULT: None