Set file's properties (name and mode).

        This function is also in charge of swapping between textual and
        binary streams.
325636
def set_properties(self, path, mode):
        
        self.name = path
        self.mode = mode

        if 'b' in self.mode:
            if not isinstance(self.read_data, bytes):
                self.read_data = bytes(self.read_data, encoding='utf8')
        else:
            if not isinstance(self.read_data, str):
                self.read_data = str(self.read_data, encoding='utf8')
1060116
def _set_feature(self, name, status):
        """"""
        setattr(self, self._feature_attrname(name), status)
197118
public synchronized void persistProperties(Properties properties, File propsFile, String message) {
    Properties toWrite = new Properties();
    for(String key : properties.stringPropertyNames()) {

      if(System.getProperties().containsKey(key) && !properties.getProperty(key).equals(System.getProperty(key))) {

        toWrite.setProperty(key, properties.getProperty(key));
      } 
      else if(System.getenv().containsKey(key) && !properties.getProperty(key).equals(System.getenv(key))) {

        toWrite.setProperty(key, properties.getProperty(key));
      } 
      else if(!System.getProperties().containsKey(key) && !System.getenv().containsKey(key)){

        toWrite.setProperty(key, properties.getProperty(key));
      }
    }
    writer.persistProperties(toWrite, propsFile, message, log);
  }
782221
function setFilename($el, $filenameTag, options) {
        var filenames = $.map($el[0].files, function (file) {return file.name}).join(', ');

        if (filenames === "") {
            filenames = options.fileDefaultHtml;
        } else {
            filenames = filenames.split(/[\/\\]+/);
            filenames = filenames[(filenames.length - 1)];
        }

        $filenameTag.text(filenames);
    }
1323463
protected void loadProperties(String filename) {
		ClassLoader thclassLoader = Thread.currentThread().getContextClassLoader();
		if (thclassLoader != null){
			URL url = thclassLoader.getResource(filename);
			if (url != null){
				try {
					this.setXMLProperties(url.openStream(), null);
				} catch (Exception e) {
					// do nothing
				} 
			}
		}
	}
426518
def set_property(self, key, value):
        

        if type(key) is str and type(value) is str:
            self.process_pair(key, value)
        else:
            raise TypeError('Both key and value should be strings!')
149900
def set_properties(self, properties):
        """"""
        if isinstance(properties, dict):
            self.properties = properties
            self.sync_properties()
        else:
            self.text = properties
1143318
public static void setFileProperties (final File file, final String contentType) throws IOException, FrameworkException {

		final java.io.File fileOnDisk = file.getFileOnDisk(false);
		final PropertyMap map         = new PropertyMap();

		map.put(StructrApp.key(File.class, "contentType"), contentType != null ? contentType : FileHelper.getContentMimeType(fileOnDisk, file.getProperty(File.name)));
		map.put(StructrApp.key(File.class, "size"),        FileHelper.getSize(fileOnDisk));
		map.put(StructrApp.key(File.class, "version"),     1);

		map.putAll(getChecksums(file, fileOnDisk));

		file.setProperties(file.getSecurityContext(), map);
	}
536871
def _set(self, key, value, identity='image'):
        
        if identity == 'image':
            s = serialize_image_file(value)
        else:
            s = serialize(value)
        self._set_raw(add_prefix(key, identity), s)
1341948
def _set_properties(self):
        """"""

        self.SetTitle(_("About pyspread"))

        label = _("pyspread {version}\nCopyright Martin Manns")
        label = label.format(version=VERSION)

        self.about_label.SetLabel(label)
701158
public void setFile(String file) {

        if (file != null) {
            m_file = file.toLowerCase();
        } else {
            m_file = null;
        }
    }
711997
def set_rule(self, name, properties):
        
        self._rule_attrs.append(name)
        setattr(self, name, properties)
1260083
def _set_properties(self, value):
        
        self._label_removals.clear()
        return super(Bucket, self)._set_properties(value)
315085
public void setProperty(String name, String value)
    {
        if ((value == null) || (value.length() == 0))
        {
            _properties.remove(name);
        }
        else
        {
            _properties.setProperty(name, value);
        }
    }
354608
@Override
	public synchronized void setOption(String name, String value) throws IOException {
		// update the property
		Properties props = getProps();
		if (value == null) {
			props.remove(name);
		} else {
			props.setProperty(name, value);
		}
		setProps(props);
		// Persist the new properties
		saveProps(props);

		long seq = SequenceNumberProvider.incrementAndGetSequenceNumber();
		// Notify update listeners
		updateNotify(seq);
		// Notify options instances using the same properties file
		propsFileUpdateNotify(props, seq);

	}
1296212
public void setFileFromAJar(String fileName) {
        InputStream is = this.getClass().getResourceAsStream(fileName);
        if(is != null) {
            this.fileName = fileName;
            reader = new InputStreamReader(is);
        }
    }
412118
function _setCurrentFile(newFilename) {
        var oldFilename = currentFilename;
        if (oldFilename === newFilename) {
            return;
        }
        currentFilename = newFilename;
        _toggleProjectScope();
        PreferencesImpl.manager.signalContextChanged(_buildContext(oldFilename, currentLanguageId),
                                                     _buildContext(newFilename, currentLanguageId));
    }