mainframe.rules¶
Attributes¶
Classes¶
Functions¶
|
Return an empty, typed rule corpus. |
|
Build authentication headers given the access token. |
|
Fetch the top commit hash of the given repository. |
|
Parse a zipfile and return a dict mapping filenames to content. |
|
Return OpenGrep rules keyed by repository-relative paths. |
|
Download the source zipfile from GitHub for the given repository. |
|
Return the commit hash and all the rules. |
Module Contents¶
- mainframe.rules.build_auth_header(access_token: str) dict[str, str][source]¶
Build authentication headers given the access token.
- mainframe.rules.fetch_commit_hash(http_client: httpx.Client, *, repository: str, access_token: str) str[source]¶
Fetch the top commit hash of the given repository.
- mainframe.rules.parse_zipfile(zipfile: zipfile.ZipFile) dict[str, str][source]¶
Parse a zipfile and return a dict mapping filenames to content.
- mainframe.rules.parse_opengrep_rules(zipfile: zipfile.ZipFile) dict[str, str][source]¶
Return OpenGrep rules keyed by repository-relative paths.
- mainframe.rules.fetch_zipfile(http_client: httpx.Client, *, repository: str, access_token: str) zipfile.ZipFile[source]¶
Download the source zipfile from GitHub for the given repository.