Update the boundaries, handling possible conflicts.

		:param conflict: What to do in case of failure: 'silent', 'warning' or 'error'.
436226
def update_values(self, min=None, max=None, conflict='warning'):
		
		conflict_txt = None
		if min is not None:
			if min > self.min:
				if min > self.max:
					self.max = self.highest
					self.prefer_highest = False
					conflict_txt = 'Minimum {0:s} conflicts with maximum {1:s}; minimum is higher so it takes precedence, but lower values in range are not preferred.'.format('{0:d}.{1:d}'.format(*self.to_tup(min)), '{0:d}.{1:d}'.format(*self.to_tup(self.max)))
				self.min = min
		if max is not None:
			if max < self.max:
				if max >= self.min:
					self.max = max
				else:
					self.prefer_highest = False
					conflict_txt = 'Maximum {0:s} conflicts with minimum {1:s}; minimum is higher so takes it precedence, but lower values in range are now preferred.'.format('{0:d}.{1:d}'.format(*self.to_tup(max)), '{0:d}.{1:d}'.format(*self.to_tup(self.min)))
		if conflict_txt:
			version_problem_notify(conflict_txt, conflict=conflict)
708831
def has_conflicting_update(self, update):
        
        # we explicitly want a flat list of updates here, that's why we call iter_updates
        # with both `initial` and `scheduled` == False
        for _, _, _, updates in self.iter_updates(initial=False, scheduled=False):
            for _update in updates:
                if (
                        update.requirement.key == _update.requirement.key and
                        (
                                update.commit_message != _update.commit_message or
                                update.requirement.latest_version_within_specs !=
                                _update.requirement.latest_version_within_specs
                        )
                ):
                    logger.info("{} conflicting with {}/{}".format(
                        update.requirement.key,
                        update.requirement.latest_version_within_specs,
                        _update.requirement.latest_version_within_specs)
                    )
                    return True
        return False
925824
def update(session_token, testing = False):
    

    conflict_comparison_file_dest = cpjoin(config['data_dir'], '.shttpfs', 'conflict_files')
    conflict_resolution_path = cpjoin(config['data_dir'], '.shttpfs', 'conflict_resolution.json')
    conflict_resolutions = file_or_default(conflict_resolution_path, [], json.loads)

    # Make sure that all conflicts have been resolved, reject if not
    if not all(len(c['4_resolution']) == 1 for c in conflict_resolutions): conflict_resolutions = []

    # Send the changes and the revision of the most recent update to the server to find changes
    manifest, client_changes = find_local_changes()

    req_result, headers = server_connection.request("find_changed", {
        "session_token"        : session_token,
        'repository'           : config['repository'],
        "previous_revision"    : manifest['have_revision'],
        }, {
            "client_changes"       : json.dumps(client_changes),
            "conflict_resolutions" : json.dumps(conflict_resolutions)})

    if headers['status'] != 'ok':
        if headers['msg'] == 'Please resolve conflicts':
            raise SystemExit('Server error: Please resolve conflicts in .shttpfs/conflict_resolution.json')
        else:
            raise SystemExit('Server error')

    result = json.loads(req_result)
    changes = result['sorted_changes']

    # Are there any changes?
    if all(v == [] for k,v in changes.iteritems()):
        print 'Nothing to update'
        return

    # Pull and delete from remote to local
    if changes['client_pull_files'] != []:
        # Filter out pull ignore files
        filtered_pull_files = []
        for fle in changes['client_pull_files']:
            if not next((True for flter in config['pull_ignore_filters'] if fnmatch.fnmatch(fle['path'], flter)), False):
                filtered_pull_files.append(fle)
            else: # log ignored items to give the opportunity to pull them in the future
                with open(cpjoin(working_copy_base_path, '.shttpfs', 'pull_ignored_items'), 'a') as pull_ignore_log:
                    pull_ignore_log.write(json.dumps((result['head'], fle)))
                    pull_ignore_log.flush()

        if filtered_pull_files != []:
            print 'Pulling files from server...'

        #----------
        for fle in filtered_pull_files:
            print 'Pulling file: ' + fle['path']

            req_result, headers = server_connection.request("pull_file", {
                'session_token' : session_token,
                'repository'    : config['repository'],
                'path'          : fle['path']}, gen = True)

            if headers['status'] != 'ok':
                raise SystemExit('Failed to pull file')
            else:
                make_dirs_if_dont_exist(data_store.get_full_file_path(cpjoin(*fle['path'].split('/')[:-1]) + '/'))
                data_store.fs_put(fle['path'], req_result)

    # Files which have been deleted on server and need deleting on client
    if changes['to_delete_on_client'] != []:
        print 'Removing files deleted on the server...'

        for fle in changes['to_delete_on_client']:
            print 'Deleting file: ' + fle['path']

            try: data_store.fs_delete(fle['path'])
            except OSError: print 'Warning: remote deleted file does not exist locally.'

            # Delete the folder if it is now empty
            try: os.removedirs(os.path.dirname(data_store.get_full_file_path(fle['path'])))
            except OSError as e:
                if e.errno not in [errno.ENOTEMPTY, errno.ENOENT]: raise

    # Files which are in conflict
    if changes['conflict_files'] != []:
        print "There are conflicts!\n"

        out = []; server_versions = []
        for fle in changes['conflict_files']:
            fle['resolution'] = ['local', 'remote']
            print 'Path:          ' + fle['file_info']['path']
            print 'Client status: ' + fle['client_status']
            print 'Server status: ' + fle['server_status']
            print
            out.append({'1_path'          : fle['file_info']['path'],
                        '2_client_status' : fle['client_status'],
                        '3_server_status' : fle['server_status'],
                        '4_resolution'    : ['client', 'server']})
            if fle['server_status'] == 'Changed': server_versions.append(fle['file_info'])

        #===============
        if server_versions != []:
            choice = None
            if not testing:
                while True:
                    print 'Download server versions for comparison? (Y/N)'
                    choice = raw_input()
                    if choice.lower() in ['y', 'n']: break
            else: choice = 'y'

            errors = []
            if choice == 'y':
                for fle in server_versions:
                    print 'Pulling file: ' + fle['path']

                    result, headers = server_connection.request("pull_file", {
                        'session_token' : session_token,
                        'repository'    : config['repository'],
                        'path'          : fle['path']}, gen = True)

                    if headers['status'] != 'ok':
                        errors.append(fle['path'])

                    else:
                        make_dirs_if_dont_exist(cpjoin(conflict_comparison_file_dest, *fle['path'].split('/')[:-1]) + '/')
                        result(cpjoin(conflict_comparison_file_dest, fle['path']))

                print 'Server versions of conflicting files written to .shttpfs/conflict_files\n'

            pprint(errors)

        # ====================

        file_put_contents(conflict_resolution_path, json.dumps(out, indent=4, sort_keys=True))
        raise SystemExit("Conflict resolution file written to .shttpfs/conflict_resolution.json\n" +
                         "Please edit this file removing 'client', or 'server' to choose which version to retain.")

    # Update the latest revision in the manifest only if there are no conflicts
    else:
        data_store.begin()
        manifest = data_store.read_local_manifest()
        manifest['have_revision'] = result['head']
        data_store.write_local_manifest(manifest)
        data_store.commit()

        #delete the conflicts resolution file and recursively delete any conflict files downloaded for comparison
        ignore(os.remove, conflict_resolution_path)
        ignore(shutil.rmtree, conflict_comparison_file_dest)

        if changes['to_delete_on_server'] != [] or changes['client_push_files'] != []:
            print 'There are local changes to commit'
        else:
            print 'Update OK'
126925
def external_incompatibilities(self):  # type: () -> Generator[Incompatibility]
        
        if isinstance(self._cause, ConflictCause):
            cause = self._cause  # type: ConflictCause
            for incompatibility in cause.conflict.external_incompatibilities:
                yield incompatibility

            for incompatibility in cause.other.external_incompatibilities:
                yield incompatibility
        else:
            yield self
1234672
def merge_conflicts(self):
        """"""
        filenames = set()
        listing = self.context.capture('hg', 'resolve', '--list')
        for line in listing.splitlines():
            tokens = line.split(None, 1)
            if len(tokens) == 2:
                status, name = tokens
                if status and name and status.upper() != 'R':
                    filenames.add(name)
        return sorted(filenames)
704527
def _set_bounds(self, bounds):
        """"""

        # Use the properties so that the checks and the handling of units are made automatically

        min_value, max_value = bounds

        # Remove old boundaries to avoid problems with the new one, if the current value was within the old boundaries
        # but is not within the new ones (it will then be adjusted automatically later)
        self.min_value = None
        self.max_value = None

        self.min_value = min_value

        self.max_value = max_value
46310
def get_boundary(self, failobj=None):
        
        missing = object()
        boundary = self.get_param('boundary', missing)
        if boundary is missing:
            return failobj
        # RFC 2046 says that boundaries may begin but not end in w/s
        return utils.collapse_rfc2231_value(boundary).rstrip()
878050
def view_conflicts(L, normalize=True, colorbar=True):
    """"""
    L = L.todense() if sparse.issparse(L) else L
    C = _get_conflicts_matrix(L, normalize=normalize)
    plt.imshow(C, aspect="auto")
    plt.title("Conflicts")
    if colorbar:
        plt.colorbar()
    plt.show()
800118
def update(self, interfaces=None):
        

        data = {'interfaces': interfaces}

        return super(ApiInterfaceRequest, self).put('api/v3/interface/', data)
1294614
def update_default(self, new_default, respect_none=False):
        
        if new_default is not None:
            self.default = new_default
        elif new_default is None and respect_none:
            self.default = None
200238
def update_dispute(self, idempotency_key=None, **params):
        """"""
        url = self.instance_url() + '/dispute'
        headers = populate_headers(idempotency_key)
        d = self.request('post', url, params, headers)
        d.addCallback(lambda response: self.refresh_from(
            {'dispute': response}, api_key, True))
        return d.addCallback(lambda _: self.dispute)
344378
function addNonConflicted(sourceNode, callback) {
    conflict.isConflictedCopy(fs, sourceNode.path, function(err, conflicted) {
      if(err) {
        return callback(err);
      }

      if(!conflicted) {
        sources.push(sourceNode);
      }

      callback(null, sources);
    });
  }
848174
def first_failing(conflict_set_size, crs, continuous: false, max_iterations: nil)
      min_idx = conflict_set_size
      max_idx = crs.nb_constraints - 1

      loop do
        unless max_iterations.nil?
          return min_idx..max_idx if max_iterations <= 0
          max_iterations -= 1
        end
        half_constraint_idx = (max_idx + min_idx) / 2
        # puts "Refining: [#{min_idx}:#{max_idx}] -> #{half_constraint_idx}"
        crs2 = crs.restrict_to_n_constraints(half_constraint_idx + 1)
        problem = Problem.from_compressed_row_storage(crs2, continuous: continuous)
        if infeasible?(problem)
          max_idx = half_constraint_idx
          # puts "                                INFEAS"
        else
          min_idx = half_constraint_idx + 1
          # puts "                                FEAS"
        end
        next if max_idx != min_idx
        return nil if max_idx > crs.nb_constraints
        return min_idx..max_idx
      end
      # Shouldn't come here if the whole problem is infeasible
      nil
    end
384702
def handle_update(self, args):
    """"""
    _LOGGER.debug("handle_update %d -- %s" % (self._integration_id, args))
    state = int(args[0])
    if state != Output._ACTION_ZONE_LEVEL:
      return False
    level = float(args[1])
    _LOGGER.debug("Updating %d(%s): s=%d l=%f" % (
        self._integration_id, self._name, state, level))
    self._level = level
    self._query_waiters.notify()
    self._dispatch_event(Output.Event.LEVEL_CHANGED, {'level': self._level})
    return True
677370
private static void updateCheckConflict(
            Map<TemporalField, Long> fieldValues,
            TemporalField targetField,
            TemporalField changeField,
            long changeValue) {
        
        Long old = fieldValues.put(changeField, changeValue);
        if (old != null && changeValue != old.longValue()) {
            throw new DateTimeException(
                    "Conflict found: " + changeField + " " + old +
                    " differs from " + changeField + " " + changeValue +
                    " while resolving  " + targetField);
        }
    }
77295
public void setup(final Map<URI, URI> conflictTable) {
        for (final Map.Entry<URI, URI> e: changeTable.entrySet()) {
            assert e.getKey().isAbsolute();
            assert e.getValue().isAbsolute();
        }
        this.conflictTable = conflictTable;
    }
136502
def _default_conflict_solver(match, conflicting_match):
    
    if len(conflicting_match.initiator) < len(match.initiator):
        return conflicting_match
    if len(match.initiator) < len(conflicting_match.initiator):
        return match
    return None