Skip to content

Commit 979243f

Browse files
committed
type anotation and doc
1 parent fc965aa commit 979243f

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

private-sec-reporting.py

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,22 @@
1717
'Accept': 'application/vnd.github.v3+json'
1818
}
1919

20-
async def check_private_vulnerability_reporting(session, org, repo_name):
20+
async def check_private_vulnerability_reporting(session: aiohttp.ClientSession, org: str, repo_name: str) -> bool:
21+
"""Check if private vulnerability reporting is enabled for a repository
22+
23+
Parameters
24+
----------
25+
session: aiohttp.ClientSession
26+
The aiohttp client session
27+
org: str
28+
The organization name
29+
repo_name: str
30+
The repository name
31+
32+
Returns
33+
-------
34+
bool: True if enabled, False otherwise
35+
"""
2136
url = f'https://api.github.com/repos/{org}/{repo_name}/private-vulnerability-reporting'
2237

2338
async with session.get(url, headers=headers) as response:
@@ -26,7 +41,20 @@ async def check_private_vulnerability_reporting(session, org, repo_name):
2641
return data.get('enabled', False)
2742
return False
2843

29-
async def get_org_repos(session, org):
44+
async def get_org_repos(session: aiohttp.ClientSession, org: str) -> list[dict]:
45+
"""Get all repositories for an organization
46+
47+
Parameters
48+
----------
49+
session: aiohttp.ClientSession
50+
The aiohttp client session
51+
org: str
52+
The organization name
53+
54+
Returns
55+
-------
56+
list[dict]: The list of repositories
57+
"""
3058
repos = []
3159
page = 1
3260
while True:

0 commit comments

Comments
 (0)