'Create an instance using the filename and stat/read info
from the given path to initialize.
@param follow_symlinks {boolean} can be set to True to have
the textinfo returned for a symlink be for linked-to file. By
default the textinfo is for the symlink itself.
@param quick_determine_lang {boolean} can be set to True to have
processing stop as soon as the language has been determined.
Note that this means some fields will not be populated.
@param env {runtime environment} A "runtime environment" class
whose behaviour is used to influence processing. Currently
it is just used to provide a hook for lang determination
by filename (for Komodo).'

@classmethod
def init_from_path(cls, path, encoding=None, lidb=None, follow_symlinks=False, quick_determine_lang=False, env=None):

    if (lidb is None):
        lidb = langinfo.get_default_database()
    self = cls()
    self.path = path
    self._accessor = PathAccessor(path, follow_symlinks=follow_symlinks)
    try:
        self._classify_from_stat(lidb)
        if (self.file_type_name != 'regular    file'):
            return self
        self._classify_from_filename(lidb, env)
        if (self.is_text is False):
            return self
        if (self.lang and quick_determine_lang):
            return self
        if (not self.lang):
            self._classify_from_magic(lidb)
            if (self.is_text is False):
                return self
        if (self.lang and quick_determine_lang):
            return self
        self._classify_encoding(lidb, suggested_encoding=encoding)
        if ((self.is_text is None) and self.encoding):
            self.is_text = True
        if (self.is_text is False):
            return self
        self.text = self._accessor.text
        if self.text:
            self._classify_from_content(lidb)
        return self
    finally:
        del self._accessor
