Skip to content

Commit

Permalink
Incorporating linter suggestions (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
datasome committed Oct 19, 2023
1 parent ca344d4 commit cb3a36f
Show file tree
Hide file tree
Showing 4 changed files with 261 additions and 141 deletions.
31 changes: 20 additions & 11 deletions cellphonedb/utils/db_releases_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,7 @@ def get_remote_database_versions_html(include_file_browsing: bool = False, min_v
rel_version = float('.'.join(rel_tag.replace('v', '').split(".")[0:2]))
if rel_version < min_version:
continue
html += "<td {}><a class=\"teal-text\" href=\"{}\">{}</a></td>" \
.format(css_style, rel['html_url'], rel['tag_name'])
html += "<td {}>{}</td>".format(css_style, rel['published_at'].split("T")[0])
if include_file_browsing:
html += ("<td {}><a class='dropdown-trigger grey lighten-1' href='#' data-target='{}_dropdown'>" +
"<i class=\"material-icons teal-text\">pageview</i></a>").format(css_style, rel['tag_name'])
html += "<ul id='{}_dropdown' class='dropdown-content'>".format(rel['tag_name'])
for file_name in ["gene_input", "protein_input", "complex_input", "interaction_input"]:
html += "<li><a href=\"javascript:get_input_file_as_html_table(\'{}\',\'{}\');\">{}</a></li>" \
.format(rel['tag_name'], file_name, file_name)
html += "</ul></td>"
html += get_release_info(rel, css_style, include_file_browsing)
html += "</tr>"
html += "</table>"
result['db_releases_html_table'] = html
Expand All @@ -67,6 +57,25 @@ def get_remote_database_versions_html(include_file_browsing: bool = False, min_v
return result


def get_release_info(
rel: dict,
css_style: str,
include_file_browsing: bool
) -> str:
html = "<td {}><a class=\"teal-text\" href=\"{}\">{}</a></td>" \
.format(css_style, rel['html_url'], rel['tag_name'])
html += "<td {}>{}</td>".format(css_style, rel['published_at'].split("T")[0])
if include_file_browsing:
html += ("<td {}><a class='dropdown-trigger grey lighten-1' href='#' data-target='{}_dropdown'>" +
"<i class=\"material-icons teal-text\">pageview</i></a>").format(css_style, rel['tag_name'])
html += "<ul id='{}_dropdown' class='dropdown-content'>".format(rel['tag_name'])
for file_name in ["gene_input", "protein_input", "complex_input", "interaction_input"]:
html += "<li><a href=\"javascript:get_input_file_as_html_table(\'{}\',\'{}\');\">{}</a></li>" \
.format(rel['tag_name'], file_name, file_name)
html += "</ul></td>"
return html


def _github_query(kind) -> Union[dict, list]:
queries = {
'releases': 'https://api.github.com/repos/{}/{}/releases'.format('ventolab', 'cellphonedb-data'),
Expand Down
Loading

0 comments on commit cb3a36f

Please sign in to comment.