class_docstr: Repository(baseurl, destpath='.')
  
  A data repository where multiple DataSource's share a base
  URL/directory.
  
  `Repository` extends `DataSource` by prepending a base URL (or
  directory) to all the files it handles. Use `Repository` when you will
  be working with multiple files from one base URL.  Initialize
  `Repository` with the base URL, then refer to each file by its filename
  only.
  
  Parameters
  ----------
  baseurl : str
      Path to the local directory or remote location that contains the
      data files.
  destpath : str or None, optional
      Path to the directory where the source file gets downloaded to for
      use.  If `destpath` is None, a temporary directory will be created.
      The default path is the current directory.
  
  Examples
  --------
  To analyze all files in the repository, do something like this
  (note: this is not self-contained code)::
  
      >>> repos = np.lib._datasource.Repository('/home/user/data/dir/')
      >>> for filename in filelist:
      ...     fp = repos.open(filename)
      ...     fp.analyze()
      ...     fp.close()
  
  Similarly you could use a URL for a repository::
  
      >>> repos = np.lib._datasource.Repository('http://www.xyz.edu/data')
class_docstr_tok: ["Repository","(","baseurl",",","destpath=","'",".","'",")","A","data","repository","where","multiple","DataSource","'s","share","a","base","URL\/directory",".","`","Repository","`","extends","`","DataSource","`","by","prepending","a","base","URL","(","or","directory",")","to","all","the","files","it","handles",".","Use","`","Repository","`","when","you","will","be","working","with","multiple","files","from","one","base","URL",".","Initialize","`","Repository","`","with","the","base","URL",",","then","refer","to","each","file","by","its","filename","only",".","Parameters","--","--","--","--","--","baseurl",":","str","Path","to","the","local","directory","or","remote","location","that","contains","the","data","files",".","destpath",":","str","or","None",",","optional","Path","to","the","directory","where","the","source","file","gets","downloaded","to","for","use",".","If","`","destpath","`","is","None",",","a","temporary","directory","will","be","created",".","The","default","path","is","the","current","directory",".","Examples","--","--","--","--","To","analyze","all","files","in","the","repository",",","do","something","like","this","(","note",":","this","is","not","self-contained","code",")",":",":",">",">",">","repos","=","np.lib._datasource.Repository","(","'\/home\/user\/data\/dir\/","'",")",">",">",">","for","filename","in","filelist",":","...","fp","=","repos.open","(","filename",")","...","fp.analyze","(",")","...","fp.close","(",")","Similarly","you","could","use","a","URL","for","a","repository",":",":",">",">",">","repos","=","np.lib._datasource.Repository","(","'http",":","\/\/www.xyz.edu\/data","'",")"]
docstr: Open and return file-like object prepending Repository base URL.
  
  If `path` is an URL, it will be downloaded, stored in the
  DataSource directory and opened from there.
  
  Parameters
  ----------
  path : str
      Local file path or URL to open. This may, but does not have to,
      include the `baseurl` with which the `Repository` was
      initialized.
  mode : {'r', 'w', 'a'}, optional
      Mode to open `path`.  Mode 'r' for reading, 'w' for writing,
      'a' to append. Available modes depend on the type of object
      specified by `path`. Default is 'r'.
  encoding : {None, str}, optional
      Open text file with given encoding. The default encoding will be
      what `io.open` uses.
  newline : {None, str}, optional
      Newline to use when reading text file.
  
  Returns
  -------
  out : file object
      File object.
docstr_tok: ["Open","and","return","file-like","object","prepending","Repository","base","URL",".","If","`","path","`","is","an","URL",",","it","will","be","downloaded",",","stored","in","the","DataSource","directory","and","opened","from","there",".","Parameters","--","--","--","--","--","path",":","str","Local","file","path","or","URL","to","open",".","This","may",",","but","does","not","have","to",",","include","the","`","baseurl","`","with","which","the","`","Repository","`","was","initialized",".","mode",":","{","'","r","'",",","'","w","'",",","'","a","'","}",",","optional","Mode","to","open","`","path","`",".","Mode","'","r","'","for","reading",",","'","w","'","for","writing",",","'","a","'","to","append",".","Available","modes","depend","on","the","type","of","object","specified","by","`","path","`",".","Default","is","'","r","'",".","encoding",":","{","None",",","str","}",",","optional","Open","text","file","with","given","encoding",".","The","default","encoding","will","be","what","`","io.open","`","uses",".","newline",":","{","None",",","str","}",",","optional","Newline","to","use","when","reading","text","file",".","Returns","--","--","--","-","out",":","file","object","File","object","."]
code: def open(self, path, mode="r", encoding=None, newline=None):
      """
      Open and return file-like object prepending Repository base URL.
  
      If `path` is an URL, it will be downloaded, stored in the
      DataSource directory and opened from there.
  
      Parameters
      ----------
      path : str
          Local file path or URL to open. This may, but does not have to,
          include the `baseurl` with which the `Repository` was
          initialized.
      mode : {'r', 'w', 'a'}, optional
          Mode to open `path`.  Mode 'r' for reading, 'w' for writing,
          'a' to append. Available modes depend on the type of object
          specified by `path`. Default is 'r'.
      encoding : {None, str}, optional
          Open text file with given encoding. The default encoding will be
          what `io.open` uses.
      newline : {None, str}, optional
          Newline to use when reading text file.
  
      Returns
      -------
      out : file object
          File object.
  
      """
      return DataSource.open(
          self,
          self._fullpath(path),
          mode,
          encoding=encoding,
          newline=newline,
      )
  
imports: import os
  import io
  from .._utils import set_module
label_desc: Use image node_id 7 for calling the Repository obj's underlying member method code with example usage: obj.open(path, mode, encoding, newline) and returns: DataSource