qcfractal/interface/client.py
def list_collections(
        self,
        collection_type: Optional[str] = None,
        aslist: bool = False,
        group: Optional[str] = "default",
        show_hidden: bool = False,
        tag: Optional[Union[str, List[str]]] = None,
    ) -> pd.DataFrame:
        """Lists the available collections currently on the server.

        Parameters
        ----------
        collection_type : Optional[str], optional
            If `None` all collection types will be returned, otherwise only the
            specified collection type will be returned
        aslist : bool, optional
            Returns a canonical list rather than a dataframe.
        group: Optional[str], optional
            Show only collections belonging to a specified group.
            To explicitly return all collections, set group=None
        show_hidden: bool, optional
            Show collections whose visibility flag is set to False. Default: False.
        tag: Optional[Union[str, List[str]]], optional
            Show collections whose tags match one of the passed tags. By default, collections are not filtered on tag.
        Returns
        -------
        DataFrame
            A dataframe containing the collection, name, and tagline.
        """

        query: Dict[str, str] = {}
        if collection_type is not None:
            query = {"collection": collection_type.lower()}

        payload = {"meta": {"include": ["name", "collection", "tagline", "visibility", "group", "tags"]}, "data": query}
        response: List[Dict[str, Any]] = self._automodel_request("collection", "get", payload, full_return=False)

        # Rename collection names
        repl_name_map = collections_name_map()
        for item in response:
            item.pop("id", None)
            if item["collection"] in repl_name_map:
                item["collection"] = repl_name_map[item["collection"]]

        if len(response) == 0:
            df = pd.DataFrame(columns=["name", "collection", "tagline"])
        else:
            df = pd.DataFrame.from_dict(response)
            if not show_hidden:
                df = df[df["visibility"]]
            if group is not None:
                df = df[df["group"].str.lower() == group.lower()]
            if tag is not None:
                if isinstance(tag, str):
                    tag = [tag]
                tag = {t.lower() for t in tag}
                df = df[df.apply(lambda x: len({t.lower() for t in x["tags"]} & tag) > 0, axis=1)]

            df.drop(["visibility", "group", "tags"], axis=1, inplace=True)
        if not aslist:
            df.set_index(["collection", "name"], inplace=True)
            df.sort_index(inplace=True)
            return df
        else:
            if collection_type is None:
                ret: DefaultDict[Any, List] = defaultdict(list)
                for entry in df.iterrows():
                    ret[entry[1]["collection"]].append(entry[1]["name"])
                return dict(ret)
            else:
                return list(df.name)
Lists the available collections currently on the server.

        Parameters
        ----------
        collection_type : Optional[str], optional
            If `None` all collection types will be returned, otherwise only the
            specified collection type will be returned
        aslist : bool, optional
            Returns a canonical list rather than a dataframe.
        group: Optional[str], optional
            Show only collections belonging to a specified group.
            To explicitly return all collections, set group=None
        show_hidden: bool, optional
            Show collections whose visibility flag is set to False. Default: False.
        tag: Optional[Union[str, List[str]]], optional
            Show collections whose tags match one of the passed tags. By default, collections are not filtered on tag.
        Returns
        -------
        DataFrame
            A dataframe containing the collection, name, and tagline.
        
Lists the available collections currently on the server.
Parameters

collection_type : Optional[str], optional
If `None` all collection types will be returned, otherwise only the
specified collection type will be returned
aslist : bool, optional
Returns a canonical list rather than a dataframe.
group: Optional[str], optional
Show only collections belonging to a specified group.
To explicitly return all collections, set group=None
show_hidden: bool, optional
Show collections whose visibility flag is set to False. Default: False.
tag: Optional[Union[str, List[str]]], optional
Show collections whose tags match one of the passed tags. By default, collections are not filtered on tag.
Returns

DataFrame
A dataframe containing the collection, name, and tagline.
Lists the available collections currently on the server . Parameters collection_type : Optional [ str ] optional If ` None ` all collection types will be returned otherwise only the specified collection type will be returned aslist : bool optional Returns a canonical list rather than a dataframe . group : Optional [ str ] optional Show only collections belonging to a specified group . To explicitly return all collections set group = None show_hidden : bool optional Show collections whose visibility flag is set to False . Default : False . tag : Optional [ Union [ str List [ str ]]] optional Show collections whose tags match one of the passed tags . By default collections are not filtered on tag . Returns DataFrame A dataframe containing the collection name and tagline .
def list_collections(
        self,
        collection_type: Optional[str] = None,
        aslist: bool = False,
        group: Optional[str] = "default",
        show_hidden: bool = False,
        tag: Optional[Union[str, List[str]]] = None,
    ) -> pd.DataFrame:
        query: Dict[str, str] = {}
        if collection_type is not None:
            query = {"collection": collection_type.lower()}
        payload = {"meta": {"include": ["name", "collection", "tagline", "visibility", "group", "tags"]}, "data": query}
        response: List[Dict[str, Any]] = self._automodel_request("collection", "get", payload, full_return=False)
        repl_name_map = collections_name_map()
        for item in response:
            item.pop("id", None)
            if item["collection"] in repl_name_map:
                item["collection"] = repl_name_map[item["collection"]]
        if len(response) == 0:
            df = pd.DataFrame(columns=["name", "collection", "tagline"])
        else:
            df = pd.DataFrame.from_dict(response)
            if not show_hidden:
                df = df[df["visibility"]]
            if group is not None:
                df = df[df["group"].str.lower() == group.lower()]
            if tag is not None:
                if isinstance(tag, str):
                    tag = [tag]
                tag = {t.lower() for t in tag}
                df = df[df.apply(lambda x: len({t.lower() for t in x["tags"]} & tag) > 0, axis=1)]
            df.drop(["visibility", "group", "tags"], axis=1, inplace=True)
        if not aslist:
            df.set_index(["collection", "name"], inplace=True)
            df.sort_index(inplace=True)
            return df
        else:
            if collection_type is None:
                ret: DefaultDict[Any, List] = defaultdict(list)
                for entry in df.iterrows():
                    ret[entry[1]["collection"]].append(entry[1]["name"])
                return dict(ret)
            else:
                return list(df.name)
def list_collections ( self , collection_type : Optional [ str ] = None , aslist : bool = False , group : Optional [ str ] = "default" , show_hidden : bool = False , tag : Optional [ Union [ str , List [ str ] ] ] = None , ) -> pd . DataFrame : query : Dict [ str , str ] = { } if collection_type is not None : query = { "collection" : collection_type . lower ( ) } payload = { "meta" : { "include" : [ "name" , "collection" , "tagline" , "visibility" , "group" , "tags" ] } , "data" : query } response : List [ Dict [ str , Any ] ] = self . _automodel_request ( "collection" , "get" , payload , full_return = False ) repl_name_map = collections_name_map ( ) for item in response : item . pop ( "id" , None ) if item [ "collection" ] in repl_name_map : item [ "collection" ] = repl_name_map [ item [ "collection" ] ] if len ( response ) == 0 : df = pd . DataFrame ( columns = [ "name" , "collection" , "tagline" ] ) else : df = pd . DataFrame . from_dict ( response ) if not show_hidden : df = df [ df [ "visibility" ] ] if group is not None : df = df [ df [ "group" ] . str . lower ( ) == group . lower ( ) ] if tag is not None : if isinstance ( tag , str ) : tag = [ tag ] tag = { t . lower ( ) for t in tag } df = df [ df . apply ( lambda x : len ( { t . lower ( ) for t in x [ "tags" ] } & tag ) > 0 , axis = 1 ) ] df . drop ( [ "visibility" , "group" , "tags" ] , axis = 1 , inplace = True ) if not aslist : df . set_index ( [ "collection" , "name" ] , inplace = True ) df . sort_index ( inplace = True ) return df else : if collection_type is None : ret : DefaultDict [ Any , List ] = defaultdict ( list ) for entry in df . iterrows ( ) : ret [ entry [ 1 ] [ "collection" ] ] . append ( entry [ 1 ] [ "name" ] ) return dict ( ret ) else : return list ( df . name )
Lists the available collections currently on the server.
Lists the available collections currently on the server .
"""Lists the available collections currently on the server.

        Parameters
        ----------
        collection_type : Optional[str], optional
            If `None` all collection types will be returned, otherwise only the
            specified collection type will be returned
        aslist : bool, optional
            Returns a canonical list rather than a dataframe.
        group: Optional[str], optional
            Show only collections belonging to a specified group.
            To explicitly return all collections, set group=None
        show_hidden: bool, optional
            Show collections whose visibility flag is set to False. Default: False.
        tag: Optional[Union[str, List[str]]], optional
            Show collections whose tags match one of the passed tags. By default, collections are not filtered on tag.
        Returns
        -------
        DataFrame
            A dataframe containing the collection, name, and tagline.
        """ # Rename collection names
self
collection_type
Optional[str]
aslist
bool
group
Optional[str]
show_hidden
bool
tag
Optional[Union[str, List[str]]]