-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UIP-49 - Fix appinfo tests #97
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
import contextlib | ||
|
||
from installed_clients.CatalogClient import Catalog | ||
from installed_clients.NarrativeMethodStoreClient import NarrativeMethodStore | ||
|
||
IGNORE_CATEGORIES = {"inactive", "importers", "viewers"} | ||
IGNORE_CATEGORIES: set = {"inactive", "importers", "viewers"} | ||
APP_TAGS: set = {"release", "beta", "dev"} | ||
|
||
|
||
def get_ignore_categories(): | ||
return {x: 1 for x in IGNORE_CATEGORIES} | ||
def get_ignore_categories() -> dict[str, int]: | ||
return dict.fromkeys(IGNORE_CATEGORIES, 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggested by ruff. I think it's fine. Really, I think that API call is kinda goofy in expecting a dictionary instead of a list, but 🤷 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a pretty exciting shorthand - I don't think I've seen it before. Not sure why the API couldn't just return |
||
|
||
|
||
def _shorten_types(type_list): | ||
def _shorten_types(type_list: list[str]) -> list[str]: | ||
""" | ||
convert ['KBaseMatrices.AmpliconMatrix'] to ['AmpliconMatrix'] | ||
""" | ||
shorten_types = list() | ||
shorten_types = [] | ||
for t in type_list: | ||
try: | ||
with contextlib.suppress(IndexError): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another piece of ruffage since we're ignoring errors anyway. |
||
shorten_types.append(t.split(".")[1]) | ||
except IndexError: | ||
pass | ||
|
||
return shorten_types | ||
|
||
|
||
def get_all_app_info(tag, user, nms_url, catalog_url): | ||
if tag not in ["release", "beta", "dev"]: | ||
def get_all_app_info(tag: str, user: str, nms: NarrativeMethodStore, catalog: Catalog): | ||
if not isinstance(tag, str) or tag not in APP_TAGS: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ruff suggested converting to a |
||
raise ValueError("tag must be one of 'release', 'beta', or 'dev'") | ||
nms = NarrativeMethodStore(nms_url) | ||
catalog = Catalog(catalog_url) | ||
apps = nms.list_methods({"tag": tag}) | ||
app_infos = {} | ||
module_versions = {} | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
[ | ||
{ | ||
"id": "CompoundSetUtils/compound_set_from_file", | ||
"module_name": "CompoundSetUtils", | ||
"git_commit_hash": "092bc8d86874fd83ee7d8b67a40b6a4339fe4289", | ||
"name": "Import CompoundSet from File", | ||
"ver": "2.1.3", | ||
"subtitle": "This method imports a file from the staging area as a CompoundSet", | ||
"tooltip": "This method imports a file from the staging area as a CompoundSet", | ||
"icon": { | ||
"url": "img?method_id=CompoundSetUtils/compound_set_from_file&image_name=data-blue.png&tag=release" | ||
}, | ||
"categories": [ | ||
"active", | ||
"upload" | ||
], | ||
"authors": [ | ||
"jjeffryes" | ||
], | ||
"input_types": [], | ||
"output_types": [ | ||
"KBaseBiochem.CompoundSet" | ||
], | ||
"app_type": "app", | ||
"namespace": "CompoundSetUtils" | ||
}, | ||
{ | ||
"id": "CompoundSetUtils/compound_set_from_model", | ||
"module_name": "CompoundSetUtils", | ||
"git_commit_hash": "092bc8d86874fd83ee7d8b67a40b6a4339fe4289", | ||
"name": "Make CompoundSet from Metabolic Model", | ||
"ver": "2.1.3", | ||
"subtitle": "This method genrerate a CompoundSet from compounds in a Metabolic Model", | ||
"tooltip": "This method genrerate a CompoundSet from compounds in a Metabolic Model", | ||
"icon": { | ||
"url": "img?method_id=CompoundSetUtils/compound_set_from_model&image_name=data-blue.png&tag=release" | ||
}, | ||
"categories": [ | ||
"active", | ||
"util" | ||
], | ||
"authors": [ | ||
"jjeffryes" | ||
], | ||
"input_types": [ | ||
"KBaseFBA.FBAModel" | ||
], | ||
"output_types": [ | ||
"KBaseBiochem.CompoundSet" | ||
], | ||
"app_type": "app", | ||
"namespace": "CompoundSetUtils" | ||
}, | ||
{ | ||
"id": "CompoundSetUtils/fetch_mol2_files_from_zinc", | ||
"module_name": "CompoundSetUtils", | ||
"git_commit_hash": "092bc8d86874fd83ee7d8b67a40b6a4339fe4289", | ||
"name": "Fetch And Import Mol2 from ZINC Database To CompoundSet", | ||
"ver": "2.1.3", | ||
"subtitle": "This method fetches Mol2 file from ZINC by searching inchikey associated with compound and then save the Mol2 file to the compound object", | ||
"tooltip": "This method fetches Mol2 file from ZINC by searching inchikey associated with compound and then save the Mol2 file to the compound object", | ||
"icon": { | ||
"url": "img?method_id=CompoundSetUtils/fetch_mol2_files_from_zinc&image_name=zinc15_72pt-aqua.png&tag=release" | ||
}, | ||
"categories": [ | ||
"active", | ||
"upload" | ||
], | ||
"authors": [ | ||
"tgu2" | ||
], | ||
"input_types": [ | ||
"KBaseBiochem.CompoundSet" | ||
], | ||
"output_types": [], | ||
"app_type": "app", | ||
"namespace": "CompoundSetUtils" | ||
}, | ||
{ | ||
"id": "KBaseRNASeq/view_rnaseq_analysis", | ||
"module_name": "KBaseRNASeq", | ||
"git_commit_hash": "07a2978aea7cabf4decec09c2dc51be81e26f02d", | ||
"name": "View RNASeqAnalysis", | ||
"ver": "1.0.5", | ||
"subtitle": "View RNASeqAnalysis", | ||
"tooltip": "View RNASeqAnalysis", | ||
"categories": [ | ||
"viewers" | ||
], | ||
"authors": [], | ||
"input_types": [ | ||
"KBaseRNASeq.RNASeqAnalysis" | ||
], | ||
"output_types": [], | ||
"app_type": "app", | ||
"namespace": "KBaseRNASeq" | ||
} | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[ | ||
{ | ||
"module_name_lc": "compoundsetutils", | ||
"id": "compound_set_from_model", | ||
"timestamp": 1585695012878 | ||
} | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified this to pass along the clients instead of a URL, which makes test mocking easier.