def open_file(self, path,<EOL>mode="<STR_LIT:r>",<EOL>buff_size=<NUM_LIT:0>,<EOL>replication=<NUM_LIT:0>,<EOL>blocksize=<NUM_LIT:0>,<EOL>encoding=None,<EOL>errors=None):
_complain_ifclosed(self.closed)<EOL>if not path:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>m, is_text = common.parse_mode(mode)<EOL>if not self.host:<EOL><INDENT>fret = local_file(self, path, m)<EOL>if is_text:<EOL><INDENT>cls = io.BufferedReader if m == "<STR_LIT:r>" else io.BufferedWriter<EOL>fret = TextIOWrapper(cls(fret), encoding, errors)<EOL><DEDENT>return fret<EOL><DEDENT>f = self.fs.open_file(path, m, buff_size, replication, blocksize)<EOL>cls = FileIO if is_text else hdfs_file<EOL>fret = cls(f, self, mode)<EOL>return fret<EOL>
Open an HDFS file.

Supported opening modes are "r", "w", "a". In addition, a
trailing "t" can be added to specify text mode (e.g., "rt" =
open for reading text).

Pass 0 as ``buff_size``, ``replication`` or ``blocksize`` if you want
to use the "configured" values, i.e., the ones set in the Hadoop
configuration files.

:type path: str
:param path: the full path to the file
:type mode: str
:param mode: opening mode
:type buff_size: int
:param buff_size: read/write buffer size in bytes
:type replication: int
:param replication: HDFS block replication
:type blocksize: int
:param blocksize: HDFS block size
:rtpye: :class:`~.file.hdfs_file`
:return: handle to the open file