API¶
asya.cli¶
-
asya.cli.
create_search_specs
(username, sort, order, text, involvement, query_opts)¶ Create GitHub issues search specification (params dict)
-
asya.cli.
no_print
(*args, **kwargs)¶ Dummy method for not actually printing anything
-
asya.cli.
print_result
(result)¶ Print Asya result nicely
-
asya.cli.
setup_info_msgs
(supervisor)¶ Setup text info printing for given supervisor
-
asya.cli.
setup_progressbar
(supervisor)¶ Setup progressbar for given supervisor
asya.exceptions¶
asya.logic¶
Important
This is the module to be implemented!
-
asya.logic.
gather_acquaintances
(search_specs, supervisor)¶ Gather acquaintances from GitHub issues and comments with given search_specs with counts of comments in form of dict. It uses
asyncio
andaiohttp.ClientSession
.>>> gather_acquaintances({'q': 'author:MarekSuchanek'}, supervisor) {'MarekSuchanek': 7, 'hroncok': 15, 'encukou': 10}
For more information about the
search_specs
content visit the GitHub Search API docs.Parameters: - search_specs (dict) – dictionary with search specification (params for the search)
- supervisor (asya.supervisor.AsyaSupervisor) – supervisor object used for this gathering
Returns: dictionary with usernames as keys and number of comments as values
Return type:
asya.supervisor¶
-
class
asya.supervisor.
AsyaSupervisor
(api_endpoint, token, wait_rate_limit, skip_404, per_page=100)¶ Supervisor for running the Asya gathering async procedure. It contains some procedure-wide setting and calls.
The
gather_acquaintances
function must call supervisor’sreport_
methods at the right places (described in docstrings):... # receiving and processing the issue supervisor.report_issue(issue) # additional work with the issue ...
Your implementation may add custom callbacks:
def my_procedure(issue): ... supervisor.callbacks['issue'].append(my_procedure) # my_procedure will be called when report_issue is # called on the supervisor object
You may also use
supervisor.obj
for your data as you need. Do not touch other parameters nor edit this class!Variables: - api_endpoint – API endpoint to be used for communication
- token – API token to be used (you can use
has_token
) - wait_rate_limit – True if the app should wait until the rate limit resets after it is
exceeded, False if exceeding the limit should cause
AsyaException
- skip_404 – True the app should skip 404 errors, False if they should
raise
AsyaException
- per_page – size of page for API requests
-
has_token
¶ True if the API token is set
-
obj
= None¶ User obj (can be anything)
-
report_comment
(comment)¶ Method to be called after processing of a single comment
Parameters: comment (dict) – GitHub comment (data from API)
-
report_issue
(issue)¶ Method to be called after processing of a single issue
Parameters: issue (dict) – GitHub issue (data from API)
-
report_issues_search_page
(page, number)¶ Method to be called before processing of a single result page
Parameters: