Modifies file access

        Args:
            filename (str): Filename.
            settings (dict): Can be "mode" or "owners"
977306
def file_modify(filename, settings):
        
        for k, v in settings.items():
            if k == "mode":
                os.chmod(filename,v)
            if k == "owners":
                os.chown(filename,v)
1121288
def set_input(self,filename,pass_to_command_line=True):
    
    self.__input = filename
    if pass_to_command_line:
      self.add_var_opt('input', filename)
    self.add_input_file(filename)
785898
def is_accessable_by_others(filename):
    """"""
    mode = os.stat(filename)[stat.ST_MODE]
    return mode & (stat.S_IRWXG | stat.S_IRWXO)
324120
def update_fname_label(self):
        """"""
        filename = to_text_string(self.get_current_filename())
        if len(filename) > 100:
            shorten_filename = u'...' + filename[-100:]
        else:
            shorten_filename = filename
        self.fname_label.setText(shorten_filename)
1129993
def _remove_setting(section, name, configfile, save=False):
    '''
    '''
    removed = False
    config = _load_config(configfile)
    if section in config:
        if name.lower() in config[section]:
            removed = config.remove_option(section, name)

    # Does the user want to save the file?
    if removed and save:
        write_config(configfile, config)

    return removed
913488
def __load_settings_from_file(self):
        
        filename = self.get_base_path() + 'settings.json'

        if not exists(filename):
            raise OneLogin_Saml2_Error(
                'Settings file not found: %s',
                OneLogin_Saml2_Error.SETTINGS_FILE_NOT_FOUND,
                filename
            )

        # In the php toolkit instead of being a json file it is a php file and
        # it is directly included
        with open(filename, 'r') as json_data:
            settings = json.loads(json_data.read())

        advanced_filename = self.get_base_path() + 'advanced_settings.json'
        if exists(advanced_filename):
            with open(advanced_filename, 'r') as json_data:
                settings.update(json.loads(json_data.read()))  # Merge settings

        return self.__load_settings_from_dict(settings)
924751
def set_options_from_YAML(self, filename):
        
        if not os.path.isfile(filename):
            raise IOError("File {0} not found".format(filename))
        stream = open(filename)
        data_dict = yaml.safe_load(stream)
        self.set_options_from_dict(data_dict, filename)
1164347
def save(self, filename):
        
        with open(filename, "wb") as fd:
            fd.write(self.__buff)
836943
def load_configs(self, filename):
        
        configs = np.loadtxt(filename)
        self.add_to_configs(configs)
358784
def populate(self, filename):
        

        if os.path.isfile(filename):
            fid_st = os.stat(filename)
            self.name = os.path.abspath(filename)
            self.full_name = filename
            self.size = fid_st.st_size
            self.last_modified = fid_st.st_mtime
            self.last_accessed = fid_st.st_atime
            self.last_info_changed = fid_st.st_ctime
            self.location = os.path.dirname(filename)
1296382
def save(self, filename):
		'''  '''

		import json
		f = open(filename, 'w')
		json.dump(self.settings, f, indent = 4)
		f.close()
1330842
def file_copy(filename, settings):
        
        for k, v in settings.items():
            if k.startswith("dest"):
                shutil.copyfile(filename, v)
1158929
def import_settings(self, filename):
        '''
        '''

        if not os.path.isfile(filename):
            self._logger.log(
                'error',
                'File: {} not found, continuing with default settings'.format(
                    filename
                )
            )
        else:
            with open(filename, 'r') as jsonFile:
                data = json.load(jsonFile)
                self._value_ranges = data['valueRanges']
                self._best_values = data['best_values']
                self._best_values = []
                for index, value in enumerate(data['best_values']):
                    if self._value_ranges[index] == 'int':
                        self._best_values.append(int(value))
                    else:
                        self._best_values.append(float(value))
                self.minimize = data['minimize']
                self.num_employers = data['num_employers']
                self._best_score = float(data['best_score'])
                self.limit = data['limit']
92919
def unlock_file(filename):
    '''
    
    '''
    log.trace('Removing lock for %s', filename)
    lock = filename + '.lock'
    try:
        os.remove(lock)
    except OSError as exc:
        log.trace('Unable to remove lock for %s: %s', filename, exc)
364439
def write_settings(settings):
    '''
    
    '''
    if not os.access(DATA_DIR, os.W_OK): return False
    try:
        f = open(DATA_DIR + os.sep + SETTINGS_FILE, 'w')
        f.writelines(json.dumps(settings, indent=0))
        f.close()
        os.chmod(os.path.abspath(DATA_DIR + os.sep + SETTINGS_FILE), 0o777) # to avoid (or create?) IO problems with multiple users
    except IOError:
        return False
    else:
        return True
770980
def can_patch(self, filename):
    
    filename = abspath(filename)
    for p in self.items:
      if filename == abspath(p.source):
        return self._match_file_hunks(filename, p.hunks)
    return None
1333999
def _updateFilename(self):
        
        self._filename = self._filenameLineEdit.text()
        self._guessEncoding(self._filename)
        self._previewFile()