@@ -582,48 +582,6 @@ def set_db(self, dbid: str, team: Optional[str] = None) -> str:
582582 repo = self .repo ,
583583 )
584584
585- def resource (self , ttype : ResourceType , val : Optional [str ] = None ) -> str :
586- """Create a resource identifier string based on the current config.
587-
588- Parameters
589- ----------
590- ttype : ResourceType
591- Type of resource.
592- val : str, optional
593- Branch or commit identifier.
594-
595- Returns
596- -------
597- str
598- The constructed resource string.
599-
600- Examples
601- --------
602- >>> client = Client("http://127.0.0.1:6363")
603- >>> client.resource(ResourceType.DB)
604- '<team>/<db>/'
605- >>> client.resource(ResourceType.META)
606- '<team>/<db>/_meta'
607- >>> client.resource(ResourceType.COMMITS)
608- '<team>/<db>/<repo>/_commits'
609- >>> client.resource(ResourceType.REF, "<reference>")
610- '<team>/<db>/<repo>/commit/<reference>'
611- >>> client.resource(ResourceType.BRANCH, "<branch>")
612- '<team>/<db>/<repo>/branch/<branch>'
613- """
614- base = self .team + "/" + self .db + "/"
615- ref_value = val if val else self .ref
616- branch_value = val if val else self .branch
617- urls = {
618- ResourceType .DB : base ,
619- ResourceType .META : f"{ base } _meta" ,
620- ResourceType .REPO : f"{ base } { self .repo } /_meta" ,
621- ResourceType .COMMITS : f"{ base } { self .repo } /_commits" ,
622- ResourceType .REF : f"{ base } { self .repo } /commit/{ ref_value } " ,
623- ResourceType .BRANCH : f"{ base } { self .repo } /{ branch_value } " ,
624- }
625- return urls [ttype ]
626-
627585 def _get_prefixes (self ):
628586 """Get the prefixes for a given database"""
629587 self ._check_connection ()
0 commit comments