Set the source content for a source file.
166872
public void setSourceContent(String aSourceFile, String aSourceContent) {
        String source = aSourceFile;
        if (this._sourceRoot != null) {
            source = Util.relative(this._sourceRoot, source);
        }

        if (aSourceContent != null) {
            // Add the source content to the _sourcesContents map.
            // Create a new _sourcesContents map if the property is null.
            if (this._sourcesContents == null) {
                this._sourcesContents = new HashMap<>();
            }
            this._sourcesContents.put(source, aSourceContent);
        } else if (this._sourcesContents != null) {
            // Remove the source file from the _sourcesContents map.
            // If the _sourcesContents map is empty, set the property to null.
            this._sourcesContents.remove(source);
            if (this._sourcesContents.isEmpty()) {
                this._sourcesContents = null;
            }
        }
    }
966857
def _copy_source_to_target(self):
        
        if self.source and self.target:
            for k, v in self.source.items('config'):
                # always have source override target.
                self.target.set_input(k, v)
813715
def update(self, of):
        """"""

        # The other values should be set when the file object is created with dataset.bsfile()
        for p in ('mime_type', 'preference', 'state', 'hash', 'modified', 'size', 'contents', 'source_hash', 'data'):
            setattr(self, p, getattr(of, p))

        return self
1262709
private function _setContentFromFile() {
		
		// empty original template content
		$this->setContent('');
		
		// check for template file and load it
		if ($filename = $this->getTemplate()) {
			if (file_exists($filename)) {
				$content = trim(file_get_contents($this->_filename));
				$this->setContent($content);
			}
		}
	}
1232914
def add_content(self, more_content):
        """"""
        sourcename = self.get_sourcename()

        if self.object.docs:
            self.add_line('', sourcename)
            for line in self.object.docs.splitlines():
                self.add_line(line, sourcename)

        # add additional content (e.g. from document), if present
        if more_content:
            self.add_line('', sourcename)
            for line, src in zip(more_content.data, more_content.items):
                self.add_line(line, src[0], src[1])
1200028
public final void setContent(byte[] content)
    {
        //clear non relevant flags
        this.contentString=null;
        this.contentParts=null;
        this.contentType=ContentType.BINARY;

        if(content==null)
        {
            this.contentBinary=null;
        }
        else
        {
            this.contentBinary=content.clone();
        }
    }
92736
@Override
    public void setContent(final InputStream content, final String contentType,
                           final Collection<URI> checksums, final String originalFileName,
                           final StoragePolicyDecisionPoint storagePolicyDecisionPoint)
            throws UnsupportedOperationException {
        throw new UnsupportedOperationException(
                "Cannot call setContent() on local file, call setExternalContent() instead");
    }
885678
def write_source(self, filename):
        '''
        
        '''
        return self.message._elem.getroottree().write(filename, encoding='utf8')
711665
private function processingSourceFiles(): void
  {
    $this->logVerbose('Replace references to resource files with references to optimized/minimized resource files.');

    foreach ($this->sourceFilesInfo as $source_filename)
    {
      $this->logVerbose("Processing %s.", $source_filename);

      $content = file_get_contents($source_filename);
      if ($content===false) $this->logError("Unable to read file '%s'.", $source_filename);

      $new_content = $content;

      if (strncmp($content, '<?php', 5)===0)
      {
        // Source is a PHP file.
        $new_content = $this->processPhpSourceFile($source_filename, $new_content);
      }

      $new_content = strtr($new_content, $this->replacePairs);

      if ($content!=$new_content)
      {
        $time = null;

        // If required determine the latest modification time of the source file and its referenced resource files.
        if ($this->preserveModificationTime)
        {
          $time = $this->getMaxModificationTime($source_filename, $new_content);
        }

        // Write sources file with modified references to resource files.
        $status = file_put_contents($source_filename, $new_content);
        if ($status===false) $this->logError("Updating file '%s' failed.", $source_filename);
        $this->logInfo("Updated file '%s'.", $source_filename);

        // If required set the mtime to the latest modification time of the source file and its referenced resource
        // files.
        if ($this->preserveModificationTime)
        {
          $status = touch($source_filename, $time);
          if ($status===false) $this->logError("Unable to set mtime for file '%s'.", $source_filename);
        }
      }
    }
  }
780943
public void addContentFile(String source, String resourceId) {

        if ((source != null) && (resourceId != null)) {
            try {
                m_helper.getFileBytes(source);
                m_contentFiles.add(new CmsUUID(resourceId));
            } catch (CmsImportExportException e) {
                LOG.info("File not found in import: " + source);
            }
        }
    }
818118
public void setSourcePath(Path src) {
        if (sourcePath == null) {
            sourcePath = src;
        } else {
            sourcePath.append(src);
        }
    }
325378
def set_content(self, value: RequestContent, *,
                    content_type: str = None):
        '''
        
        '''
        assert self._attached_files is None, \
               'cannot set content because you already attached files.'
        guessed_content_type = 'application/octet-stream'
        if value is None:
            guessed_content_type = 'text/plain'
            self._content = b''
        elif isinstance(value, str):
            guessed_content_type = 'text/plain'
            self._content = value.encode('utf-8')
        else:
            guessed_content_type = 'application/octet-stream'
            self._content = value
        self.content_type = (content_type if content_type is not None
                             else guessed_content_type)
32897
void setSource(Reader reader) {
		if (reader == null) {
			throw new IllegalArgumentException("'reader' must not be null.");
		}

		br =
				(reader instanceof BufferedReader) ? (BufferedReader) reader : new BufferedReader(
						reader);
	}
1293007
def write(url, content, **args):
    """"""
    with FileResource(url, **args) as resource:
        resource.write(content)
566925
def add_sources_from_file(file_name, update=True):
    

    key_regex = re.compile(r'(?P<source>[^()]*)(\s+\((?P<key>.*)\))?$')
    for line in _read_lines_from_file(file_name):
        kwargs = key_regex.match(line).groupdict()
        kwargs['update'] = False
        add_apt_source(**kwargs)
    if update:
        update_apt_sources()
162938
def set_source_text(self, p_text):
        
        self.src = p_text.strip()
        self.fields = parse_line(self.src)
1057949
public function setSourceFile($var)
    {
        GPBUtil::checkString($var, True);
        $this->source_file = $var;
        $this->has_source_file = true;

        return $this;
    }