analysis.repo_loader

exception bigbang.analysis.repo_loader.RepoLoaderWarning

Bases: BaseException

Base class for Archive class specific exceptions

bigbang.analysis.repo_loader.cache_path(name)

Takes in a name (bigbang) Returns where its cached file should be (../sample_git_repos/bigbang_backup.csv)

bigbang.analysis.repo_loader.create_graph(dic)

Converts a dictionary of dependencies into a NetworkX DiGraph.

bigbang.analysis.repo_loader.fetch_repo(url)

Takes in a git url and uses shell commands to clone the git repo into sample_git_repos/

TODO: We shouldn’t use this with shell=True because of security concerns.

bigbang.analysis.repo_loader.filepath_to_name(filepath)

Converts a filepath (../archives/sample_git_repos/{name}) to a name. Note that this will fail if the filepath ends in a “/”. It must end in the name of the folder. Thus, it should be ../archives/sample_git_repos/{name} not ../archives/sample_git_repos/{name}/

bigbang.analysis.repo_loader.get_cache(name)

Takes in a name (bigbang) Returns a GitRepo object containing the cache data if the cache exists Returns None otherwise.

bigbang.analysis.repo_loader.get_dependency_network(filepath)

Given a directory, collects all Python and IPython files and uses the Python AST to create a dictionary of dependencies from them. Returns the dependencies converted into a NetworkX graph.

bigbang.analysis.repo_loader.get_files(filepath)

Returns a list of the Python files in a directory, and converts IPython notebooks into Python source code and includes them with the Python files.

bigbang.analysis.repo_loader.get_multi_repo(repo_names=None, repos=None)

As of now, this only accepts names/repos, not local urls TODO: This could be optimized

bigbang.analysis.repo_loader.get_org_multirepo(org_name)
bigbang.analysis.repo_loader.get_org_repos(org_name)

Checks to see if we have the urls for a given org If we don’t, it fetches them. Once we do, it returns a list of GitRepo objects from the urls.

bigbang.analysis.repo_loader.get_repo(repo_in, in_type='name', update=False)
Takes three different options for type:
  • remote: basically a git url

  • name (default): a name like ‘scipy’ which the method can expand to a url

  • local: a filepath to a file on the local system

    (basically an existing git directory on this computer)

This returns an initialized GitRepo object with its data and name already loaded.

bigbang.analysis.repo_loader.load_org_repos(org_name)

fetches a list of all repos in an organization from github and gathers their URL’s (of the form *.git) It dumps these into ../examples/{org_name}_urls.txt

bigbang.analysis.repo_loader.name_to_filepath(name)

Converts a name of a repo to its filepath. Currently, these go to ../archives/sample_git_repos/{name}/

bigbang.analysis.repo_loader.repo_already_exists(filepath)
bigbang.analysis.repo_loader.url_to_name(url)

Converts a github url (e.g. https://github.com/sbenthall/bigbang.git) to a human-readable name (bigbang) by looking at the word between the last “/” and “.git”.