get_discussions_experts() — fastapi Function Reference
Architecture documentation for the get_discussions_experts() function in people.py from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD b508f7f4_39cb_5609_1086_8ac1342fe21b["get_discussions_experts()"] 4dbe490d_c30b_6033_480a_ba29c94d075d["people.py"] b508f7f4_39cb_5609_1086_8ac1342fe21b -->|defined in| 4dbe490d_c30b_6033_480a_ba29c94d075d 04dd64fd_a157_008a_06a5_7c82002acaed["main()"] 04dd64fd_a157_008a_06a5_7c82002acaed -->|calls| b508f7f4_39cb_5609_1086_8ac1342fe21b style b508f7f4_39cb_5609_1086_8ac1342fe21b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
scripts/people.py lines 196–256
def get_discussions_experts(
discussion_nodes: list[DiscussionsNode],
) -> DiscussionExpertsResults:
commenters = Counter[str]()
last_month_commenters = Counter[str]()
three_months_commenters = Counter[str]()
six_months_commenters = Counter[str]()
one_year_commenters = Counter[str]()
authors: dict[str, Author] = {}
now = datetime.now(tz=timezone.utc)
one_month_ago = now - timedelta(days=30)
three_months_ago = now - timedelta(days=90)
six_months_ago = now - timedelta(days=180)
one_year_ago = now - timedelta(days=365)
for discussion in discussion_nodes:
discussion_author_name = None
if discussion.author:
authors[discussion.author.login] = discussion.author
discussion_author_name = discussion.author.login
discussion_commentors: dict[str, datetime] = {}
for comment in discussion.comments.nodes:
if comment.author:
authors[comment.author.login] = comment.author
if comment.author.login != discussion_author_name:
author_time = discussion_commentors.get(
comment.author.login, comment.createdAt
)
discussion_commentors[comment.author.login] = max(
author_time, comment.createdAt
)
for reply in comment.replies.nodes:
if reply.author:
authors[reply.author.login] = reply.author
if reply.author.login != discussion_author_name:
author_time = discussion_commentors.get(
reply.author.login, reply.createdAt
)
discussion_commentors[reply.author.login] = max(
author_time, reply.createdAt
)
for author_name, author_time in discussion_commentors.items():
commenters[author_name] += 1
if author_time > one_month_ago:
last_month_commenters[author_name] += 1
if author_time > three_months_ago:
three_months_commenters[author_name] += 1
if author_time > six_months_ago:
six_months_commenters[author_name] += 1
if author_time > one_year_ago:
one_year_commenters[author_name] += 1
discussion_experts_results = DiscussionExpertsResults(
authors=authors,
commenters=commenters,
last_month_commenters=last_month_commenters,
three_months_commenters=three_months_commenters,
six_months_commenters=six_months_commenters,
one_year_commenters=one_year_commenters,
)
return discussion_experts_results
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does get_discussions_experts() do?
get_discussions_experts() is a function in the fastapi codebase, defined in scripts/people.py.
Where is get_discussions_experts() defined?
get_discussions_experts() is defined in scripts/people.py at line 196.
What calls get_discussions_experts()?
get_discussions_experts() is called by 1 function(s): main.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free