Add a single file to the MAR file.

        Args:
            path (str): path to a file to add to this MAR file.
            compress (str): One of 'xz', 'bz2', or None. Defaults to None.
353333
def add_file(self, path, compress):
        
        if not os.path.isfile(path):
            raise ValueError('{} is not a file'.format(path))
        self.fileobj.seek(self.last_offset)

        with open(path, 'rb') as f:
            flags = os.stat(path).st_mode & 0o777
            self.add_fileobj(f, path, compress, flags)
695267
def addextension(path, ext=None):
    
    if ext:
        if '*' in path:
            return path
        elif os.path.splitext(path)[1]:
            return path
        else:
            if not ext.startswith('.'):
                ext = '.'+ext
            if not path.endswith(ext):
                if not path.endswith(os.path.sep):
                    path += os.path.sep
                return path + '*' + ext
            else:
                return path
    else:
        return path
1004957
def _append_path(new_path):  # type: (str) -> None
    
    for path in sys.path:
        path = os.path.abspath(path)
        if new_path == path:
            return
    sys.path.append(new_path)
1136859
public function addFile($path)
    {
        $config = $this->loadFile($path);
        if (is_array($config)) {
            $this->merge($config);
        }
        return $this;
    }
1332477
def AddFileReadData(self, path, file_data_path):
    
    if self.file_system.FileEntryExistsByPath(path):
      raise ValueError('Path: {0:s} already set.'.format(path))

    with open(file_data_path, 'rb') as file_object:
      file_data = file_object.read()

    self._AddParentDirectories(path)
    self.file_system.AddFileEntry(path, file_data=file_data)
1292432
public void addFile(String path, InputStream inputStream) throws IOException {
    addFile(path, inputStream, null);
  }
791003
def include_path(self, path):
        
        self.seen_paths.add(path)
        return self.filter.include(path)
907273
def add_path(self, path):
        
        abspath = os.path.abspath(path)
        self.children.append(_build_project_tree(abspath, self.followsymlinks, self.file_filter))
62600
def add_to_path(p):
    '''
        
    '''
    old_path = sys.path
    if p not in sys.path:
        sys.path = sys.path[:]
        sys.path.insert(0, p)
    try:
        yield
    finally:
        sys.path = old_path
771756
def add(self, path):
        
        name_with_ext = os.path.split(path)[1]  # split directory and filename
        name = name_with_ext.split('.')[0]  # remove extension
        self.list.update({name: path})
919467
public void compress(String path)
	{
		try {

			File fileToArchive = new File(path);

			BufferedInputStream input = new BufferedInputStream(new FileInputStream(fileToArchive));

			File archivedFile = new File(fileToArchive.getName() + ".bz2");
			archivedFile.createNewFile();

			FileOutputStream fos = new FileOutputStream(archivedFile);
			BufferedOutputStream bufStr = new BufferedOutputStream(fos);
			// added bzip2 prefix
			fos.write("BZ".getBytes());
			CBZip2OutputStream bzip2 = new CBZip2OutputStream(bufStr);

			while (input.available() > 0) {
				int size = COMPRESSION_CACHE;

				if (input.available() < COMPRESSION_CACHE) {
					size = input.available();
				}
				byte[] bytes = new byte[size];

				input.read(bytes);

				bzip2.write(bytes);
			}
			bzip2.close();
			bufStr.close();
			fos.close();
			input.close();

		}
		catch (IOException e) {
			e.printStackTrace();
		}

	}
202232
def put(path, options = {})
      ext = options[:ext] || File.extname(path)
      path = path.to_s
      resp = http_post("/v1/#{appkey}",
                       File.open(path.start_with?('/') ? path : fpath(path)).read,
                       :params => {
                         :suffix => ext,
                         :simple_name => options[:simple_name] || 0
                       },
                       :accept => :json)

      json = JSON.parse(resp)
      json && json['TFS_FILE_NAME']
    end
1084930
public void addFile(String path, File file) throws IOException {
    addFile(path, file, null);
  }
174453
def save(self, path):
        
        for relative_path_and_filename, content in self.files.items():
            full_path_and_filename = os.path.join(path, relative_path_and_filename)
            full_path = os.path.dirname(full_path_and_filename)

            if not os.path.isdir(full_path):
                os.makedirs(full_path)

            with open(full_path_and_filename, 'wb') as handle:
                handle.write(b64decode(content))
626221
def add_attribute(self, path, name, value):
        
        node = self.add(path)
        node.attribs.append((name, value))
        return node
829023
def add_to_path(p):
    """"""
    if p not in os.environ["PATH"]:
        os.environ["PATH"] = "{0}{1}{2}".format(p, os.pathsep, os.environ["PATH"])
51491
def put_path(self, path):
        
        if self.is_package(path):
            logger.debug('PYTHON PACKAGE: {}'.format(path))
            self.python_paths.append(path.parent)
            site.addsitedir(str(path.parent))
            xbmdirs = self.get_directories_with_extensions(
                path,
                self.icon_extensions,
            )
            self.xbmlang_paths.extend(xbmdirs)
            return

        if self.has_next(path.glob('*.' + self.MEL)):
            logger.debug('MEL: {}'.format(str(path)))
            self.script_paths.append(path)

        if self.has_next(path.glob('*.' + self.PYTHON)):
            logger.debug('PYTHONPATH: {}'.format(str(path)))
            self.python_paths.append(path)
            site.addsitedir(str(path))

        if self.PLUGIN in list(path.iterdir()):
            logger.debug('PLUG-IN: {}'.format(str(path)))
            self.plug_in_paths.append(path)

        for ext in self.icon_extensions:
            if self.has_next(path.glob('*.' + ext)):
                logger.debug('XBM: {}.'.format(str(path)))
                self.xbmlang_paths.append(path)
                break