FEV_KEGG.Util.Util module¶
-
FEV_KEGG.Util.Util.chunks(iterable, chunk_size)[source]¶ Chops Iterable into chunks.
Parameters: - iterable (Iterable) – The Iterable object to be chunked.
- chunk_size (int) – The size if each chunk. Except for the last, of course.
Yields: Iterable – Iterable of the same type as iterable, but with length chunk_size. Except for the last, of course.
-
FEV_KEGG.Util.Util.deduplicateList(anyList: List[T], preserveOrder=False)[source]¶ Deduplicates a list.
Does not preserve order by default, because it is faster.
Parameters: - anyList (list) – The list to be deduplicated.
- preserveOrder (bool, optional) – If True, preserves order of elements in the list.
Returns: A new list, containing all elements of anyList, but only once.
Return type: List
-
FEV_KEGG.Util.Util.dictToHtml(dictionary, byValueFirst=False, addEcDescriptions=False, headingDescriptionForHeading=None) → str[source]¶
-
FEV_KEGG.Util.Util.dictToHtmlFile(dictionary, file, byValueFirst=False, inCacheFolder=False, addEcDescriptions=False, headingDescriptionForHeading=None)[source]¶ Parameters: - file (str) – Path and name of the exported file. See inCacheFolder.
- inCacheFolder (bool, optional) – If True, interpret file relative to the cache folder. See
FEV_KEGG.settings.cachePath. If False, interpret file relative to the current working directory.
-
FEV_KEGG.Util.Util.updateDictUpdatingValue(dictA, dictB)[source]¶ Update dictA using dictB. However, if key already exists in dictA, does not overwrite dictA[key] with dictB[key], as the defautl update() function does, instead does an update: dictA[key].update( dictB[key] ).
Warning
Only works if dictA’s values have an update() function, e.g. are sets!