empd_admin.viewer_responses module¶
Module to handle requests from the EMPD2.github.io viewer
Functions
|
Create a new branch and pull request with the given metadata |
|
Edit the meta data of an existing pull request |
|
Handle the submission of issues to the EMPD |
|
Handle a token and submit an issue |
|
Handle data contribution through the viewer |
|
Submit an issue to the EMPD2/EMPD-data repository |
|
Transform a list of temperature or precipitation into a string |
-
empd_admin.viewer_responses.
create_new_pull_request
(metadata, submitter, submitter_gh=None, commit_msg='')¶ Create a new branch and pull request with the given metadata
Not yet implemented…
-
empd_admin.viewer_responses.
edit_pull_request
(pull, meta, metadata, submitter, submitter_gh=None, commit_msg='', commit=True)¶ Edit the meta data of an existing pull request
- Parameters
pull (github.PullRequest) – The pull request on github
meta (str) – The name of the meta file for the contribution
metadata (dict) – The meta data as JSON from the viewer
submitter (str) – The name of the submitter
submitter_gh (str) – The github username of the submitter
commit_msg (str) – The message that shall be used for the commit
commit (bool) – If True, commit the changes
-
empd_admin.viewer_responses.
handle_issue_submission
(body)¶ Handle the submission of issues to the EMPD
This will create a token for the submitted body and saves it to the private EMPD-issues repository at
https://github.com/Chilipp/EMPD-issues.git
This token will then be handled by the
handle_verified_issue()
-
empd_admin.viewer_responses.
handle_verified_issue
(token)¶ Handle a token and submit an issue
This function continues what has been began with the
handle_issue_submission()
and creates the issue.- Parameters
token (str) – The sha1 token as it has been created with the
handle_issue_submission()
function- Returns
bool – True if it was successful
str – An html-formatted message of the status
-
empd_admin.viewer_responses.
handle_viewer_request
(metadata, submitter, repo='EMPD2/EMPD-data', branch='master', meta='meta.tsv', submitter_gh=None, commit_msg='')¶ Handle data contribution through the viewer
- Parameters
metadata (dict) – The meta data as JSON from the viewer
submitter (str) – The name of the submitter
repo (str) – The name of the repository (‘EMPD2/EMPD-data’)
branch (str) – The branch of the repo
meta (str) – The name of the meta file for the contribution
submitter_gh (str) – The github username of the submitter
commit_msg (str) – The message that shall be used for the commit
- Returns
bool – True, if everything went fine
str – a html-formatted report whether everything worked as expected
-
empd_admin.viewer_responses.
submit_issue
(title, msg, repo='EMPD2/EMPD-data')¶ Submit an issue to the EMPD2/EMPD-data repository
-
empd_admin.viewer_responses.
transform_list
(items)¶ Transform a list of temperature or precipitation into a string
The EMPD-data meta data holds the temperature and precipitation as comma-delimited string of the numbers
- Parameters
items (list of floats or str) – floats will be combined using
','.join
, a string is returned