Reference a file

        :returns: None
        :rtype: None
        :raises: None
343206
def reference(self, ):
        
        tfi = self.get_taskfileinfo_selection()
        if tfi:
            self.reftrack.reference(tfi)
1328396
def _load(self, file_path: Text) -> None:
        

        # noinspection PyUnresolvedReferences
        module_ = types.ModuleType('settings')
        module_.__file__ = file_path

        try:
            with open(file_path, encoding='utf-8') as f:
                exec(compile(f.read(), file_path, 'exec'), module_.__dict__)
        except IOError as e:
            e.strerror = 'Unable to load configuration file ({})'\
                .format(e.strerror)
            raise

        for key in dir(module_):
            if CONFIG_ATTR.match(key):
                self[key] = getattr(module_, key)
756202
def readReference(self):
        
        idx = self.stream.read_ushort()
        o = self.context.getObject(idx)

        if o is None:
            raise pyamf.ReferenceError('Unknown reference %d' % (idx,))

        return o
19594
def read_from_file(file_name):
    
    from .docxfile import DOCXFile

    dfile = DOCXFile(file_name)
    dfile.parse()

    return dfile
360055
def set_target_ref(self, value):
        
        if value is None or not isinstance(value, str):
            raise TypeError("TargetRef is required and must be set to a String")
        else:
            self.__target_ref = value
1195031
def get_sourcefile(self):
          # noqa

        buff = self.get_attribute("SourceFile")
        if buff is None:
            return None

        with unpack(buff) as up:
            (ref,) = up.unpack_struct(_H)

        return self.deref_const(ref)
1024675
def get_offset(self):
    
    if not self._is_open:
      raise IOError('Not opened.')

    if not hasattr(self._file_object, 'get_offset'):
      return self._file_object.tell()
    return self._file_object.get_offset()
742552
def read(self):
        # type: () -> Optional[str]
        
        with open(self.version_file) as fp:
            version = fp.read().strip()

            if is_valid(version):
                return version

            return None
50335
def from_file(cls, fn, *args, **kwargs):
        
        return AmiraHeader(get_parsed_data(fn, *args, **kwargs))
1332957
def parse_file(self, file_or_fname):
        
        with self._context():
            if hasattr(file_or_fname, 'read'):
                self.filename = getattr(
                    file_or_fname, 'name', file_or_fname.__class__.__name__)
                self.p.ParseFile(file_or_fname)
            else:
                self.filename = file_or_fname
                with open(file_or_fname, 'rb') as f:
                    self.p.ParseFile(f)
        return self._root
1356275
def save_file(self, file=None):
        

        editor = file and self.get_editor(file) or self.get_current_editor()
        if not editor:
            return False

        LOGGER.info("{0} | Saving '{1}' file!".format(self.__class__.__name__, editor.file))
        self.__lock_editor(editor)
        if not editor.is_untitled and foundations.common.path_exists(editor.file):
            return editor.save_file()
        else:
            return self.save_fileAs()
1159414
def file_contigs(ref_file, config=None):
    
    ContigInfo = collections.namedtuple("ContigInfo", "name size")
    with open(fasta_idx(ref_file, config)) as in_handle:
        for line in (l for l in in_handle if l.strip()):
            name, size = line.split()[:2]
            yield ContigInfo(name, int(size))
515494
def read_file(file):
	
	if hasattr(file, "read"):
		return file.read()
	if hasattr(file, "read_bytes"):
		return file.read_bytes()
	with open(file, "rb") as f:
		return f.read()
492958
def update_file(self):
        
        if self._filename is None:
            raise NoConfigFileReadError()
        with open(self._filename, 'w') as fb:
            self.write(fb)
630933
def from_file(self, path=None):
        
        if self._version is None:
            self._version = file_version(path or self.version_file)
        return self
62335
def _load_data(self):
        
        if self.raw_data is None and self.data_format is not FormatType.PYTHON:
            if self.file_path is None:
                raise ArgumentInvalid('One of "raw_data" or "file_path" should be set!')
            if not os.path.isfile(self.file_path) or not os.access(self.file_path, os.R_OK):
                raise ArgumentInvalid('"file_path" should be a valid path to an exist file with read permission!')
            with open(self.file_path) as f:
                self.raw_data = f.read()
29836
def from_path(cls, path: pathlib.Path) -> 'File':
        
        if not path.is_file():
            raise ValueError('Path does not point to a file')
        return File(path.name, path.stat().st_size, cls._md5(path))