Create an updated version (if needed) of the Filter via the visitor pattern.
336269
def visit_and_update_expressions(self, visitor_fn):
        """"""
        new_predicate = self.predicate.visit_and_update(visitor_fn)
        if new_predicate is not self.predicate:
            return Filter(new_predicate)
        else:
            return self
57855
def update_filters(self, filters):
        
        new_filters = {}
        for (filter, values) in filters.items():
            new_values = []
            for value in values:
                if isinstance(value, str):
                    new_values.append(value.strip("\n "))
                else:
                    new_values.append(int(value))
            values = new_values
            if len(values) != 0 and values[0] != 0 and values[0] != '':
                new_filters[filter] = values

        if new_filters != self.filters:
            self._filters = new_filters
            if self._created:
                yield from self.update()
                self._project.controller.notification.emit("link.updated", self.__json__())
                self._project.dump()
1176447
def can_be_updated(cls, dist, latest_version):
        """"""
        scheme = get_scheme('default')
        name = dist.project_name
        dependants = cls.get_dependants(name)
        for dependant in dependants:
            requires = dependant.requires()
            for requirement in cls.get_requirement(name, requires):
                req = parse_requirement(requirement)
                # Ignore error if version in requirement spec can't be parsed
                try:
                    matcher = scheme.matcher(req.requirement)
                except UnsupportedVersionError:
                    continue
                if not matcher.match(str(latest_version)):
                    return False

        return True
940244
def setup_filter(self, ):
        
        types = self.refobjinter.types.keys()
        for i, t in enumerate(types):
            cb = QtGui.QCheckBox("%s" % t)
            cb.setChecked(True)
            cb.toggled.connect(self.update_filter)
            self.typecbmap[t] = cb
            self.typefilter_grid.addWidget(cb, int(i / 4), i % 4)
703771
def release_filter(self, value):
        """"""
        compiled_pattern = coerce_pattern(value)
        if compiled_pattern.groups > 1:
            raise ValueError(compact("""
                Release filter regular expression pattern is expected to have
                zero or one capture group, but it has {count} instead!
            """, count=compiled_pattern.groups))
        set_property(self, 'release_filter', value)
        set_property(self, 'compiled_filter', compiled_pattern)
500707
protected function refreshEnvironment()
    {
        // BC fix to support Dotenv ^2.2
        if (! method_exists(Dotenv::class, 'create')) {
            (new Dotenv(base_path()))->overload();

            return;
        }

        Dotenv::create(base_path())->overload();
    }
830935
private void updateFilter()
    {
        List<RowFilter<TableModel, Integer>> regexFilters = 
            new ArrayList<RowFilter<TableModel, Integer>>();
        for (int i = 0; i < textFields.size(); i++)
        {
            JTextField textField = textFields.get(i);
            if (textField == null)
            {
                continue;
            }
            String regex = textField.getText();
            RowFilter<TableModel, Integer> regexFilter = 
                createRegexFilter(regex, i);
            if (regexFilter == null)
            {
                continue;
            }
            regexFilters.add(regexFilter);
        }
        if (regexFilters.isEmpty())
        {
            filterConsumer.accept(null);
        }
        else
        {
            RowFilter<TableModel, Integer> rowFilter = 
                RowFilter.andFilter(regexFilters);
            filterConsumer.accept(rowFilter);
        }
    }
458459
def make_replacement_visitor(find_expression, replace_expression):
    """"""
    def visitor_fn(expression):
        """Return the replacement if this expression matches the expression we're looking for."""
        if expression == find_expression:
            return replace_expression
        else:
            return expression

    return visitor_fn
754011
public void accept(final WebAppVisitor visitor) {
		visitor.visit(this); // First do everything else

		for (WebAppListener listener : listeners) {
			visitor.visit(listener);
		}
		if (!filters.isEmpty()) {
			// first visit the filters with a filter mapping in mapping order
			final List<WebAppFilter> remainingFilters = new ArrayList<>(
					filters.values());
			for (String filterName : orderedFilters) {
				final WebAppFilter filter = filters.get(filterName);
				visitor.visit(filter);
				remainingFilters.remove(filter);
			}
			// then visit filters without a mapping order in the order they were
			// added
			for (WebAppFilter filter : remainingFilters) {
				visitor.visit(filter);
			}
		}
		if (!servlets.isEmpty()) {
			for (WebAppServlet servlet : getSortedWebAppServlet()) {
				// Fix for PAXWEB-205
				visitor.visit(servlet);
			}
		}
		if (!constraintsMapping.isEmpty()) {
			for (WebAppConstraintMapping constraintMapping : constraintsMapping) {
				visitor.visit(constraintMapping);
			}

		}

		for (WebAppErrorPage errorPage : errorPages) {
			visitor.visit(errorPage);
		}

		visitor.end();
	}
378662
function (newFilters, oldFilters) {
        var self = this;

        if (!oldFilters) {
            oldFilters = this._filters;
        } else if (!isArray(oldFilters)) {
            oldFilters = [oldFilters];
        }

        if (!newFilters) {
            newFilters = [];
        } else if (!isArray(newFilters)) {
            newFilters = [newFilters];
        }

        oldFilters.forEach(function (filter) {
            self._removeFilter(filter);
        });

        newFilters.forEach(function (filter) {
            self._addFilter(filter);
        });

        this._runFilters();
    }
683099
def increment_version(context):
    """"""

    attributes.replace_attribute(
        context.module_name, '__version__', context.new_version, dry_run=context.dry_run
    )
    log.info(
        'Bumped version from %s to %s' % (context.current_version, context.new_version)
    )
1149488
def visit_and_update(self, visitor_fn):
        """"""
        new_inner = self.inner_expression.visit_and_update(visitor_fn)

        if new_inner is not self.inner_expression:
            return visitor_fn(UnaryTransformation(self.operator, new_inner))
        else:
            return visitor_fn(self)
16623
void update() {
        Application.update(filter, list, main, footer, toggleAll, count, clearCompleted);
    }
662317
public function onFilterUpdate()
    {
        $this->defineFilterScopes();

        if (!$scope = post('scopeName')) {
            return;
        }

        $scope = $this->getScope($scope);

        switch ($scope->type) {
            case 'group':
                $active = $this->optionsFromAjax(post('options.active'));
                $this->setScopeValue($scope, $active);
                break;

            case 'checkbox':
                $checked = post('value') == 'true';
                $this->setScopeValue($scope, $checked);
                break;

            case 'switch':
                $value = post('value');
                $this->setScopeValue($scope, $value);
                break;

            case 'date':
                $dates = $this->datesFromAjax(post('options.dates'));

                if (!empty($dates)) {
                    list($date) = $dates;
                }
                else {
                    $date = null;
                }

                $this->setScopeValue($scope, $date);
                break;

            case 'daterange':
                $dates = $this->datesFromAjax(post('options.dates'));

                if (!empty($dates)) {
                    list($after, $before) = $dates;

                    $dates = [$after, $before];
                }
                else {
                    $dates = null;
                }

                $this->setScopeValue($scope, $dates);
                break;

            case 'number':
                $numbers = $this->numbersFromAjax(post('options.numbers'));

                if (!empty($numbers)) {
                    list($number) = $numbers;
                }
                else {
                    $number = null;
                }

                $this->setScopeValue($scope, $number);
                break;

            case 'numberrange':
                $numbers = $this->numbersFromAjax(post('options.numbers'));

                if (!empty($numbers)) {
                    list($min, $max) = $numbers;

                    $numbers = [$min, $max];
                }
                else {
                    $numbers = null;
                }

                $this->setScopeValue($scope, $numbers);
                break;

            case 'text':
                $values = post('options.value');

                if ($values !== null && $values !== '') {
                    list($value) = $values;
                }
                else {
                    $value = null;
                }

                $this->setScopeValue($scope, $value);
                break;
        }

        /*
         * Trigger class event, merge results as viewable array
         */
        $params = func_get_args();

        $result = $this->fireEvent('filter.update', [$params]);

        if ($result && is_array($result)) {
            return call_user_func_array('array_merge', $result);
        }
    }
1348330
public synchronized void accept(CacheVisitor<K,V> visitor) {
        expungeExpiredEntries();
        Map<K,V> cached = getCachedEntries();

        visitor.visit(cached);
    }
143152
public Filters.Filter buildFilter(Scan scan, ReadHooks hooks) {
    ChainFilter chain = FILTERS.chain();
    Optional<Filters.Filter> familyFilter = createColumnFamilyFilter(scan);
    if (familyFilter.isPresent()) {
      chain.filter(familyFilter.get());
    }

    if (scan.getTimeRange() != null && !scan.getTimeRange().isAllTime()) {
      chain.filter(createTimeRangeFilter(scan.getTimeRange()));
    }

    if (scan.getMaxVersions() != Integer.MAX_VALUE) {
      chain.filter(createColumnLimitFilter(scan.getMaxVersions()));
    }

    Optional<Filters.Filter> userFilter = createUserFilter(scan, hooks);
    if (userFilter.isPresent()) {
      chain.filter(userFilter.get());
    }

    return chain;
  }
505753
def _update(self, **kwargs):
        """"""

        requests_params, update_uri, session, read_only = \
            self._prepare_put_or_patch(kwargs)

        read_only_mutations = []
        for attr in read_only:
            if attr in kwargs:
                read_only_mutations.append(attr)
        if read_only_mutations:
            msg = 'Attempted to mutate read-only attribute(s): %s' \
                  % read_only_mutations
            raise AttemptedMutationOfReadOnly(msg)

        # Get the current state of the object on BIG-IP® and check the
        # generation Use pop here because we don't want force in the data_dict
        force = self._check_force_arg(kwargs.pop('force', True))
        if not force:
            # generation has a known server-side error
            self._check_generation()

        kwargs = self._check_for_boolean_pair_reduction(kwargs)

        # Save the meta data so we can add it back into self after we
        # load the new object.
        temp_meta = self.__dict__.pop('_meta_data')

        # Need to remove any of the Collection objects from self.__dict__
        # because these are subCollections and _meta_data and
        # other non-BIG-IP® attrs are not removed from the subCollections
        # See issue #146 for details
        tmp = dict()
        for key, value in iteritems(self.__dict__):
            # In Python2 versions we were changing a dictionary in place,
            # but this cannot be done with an iterator as an error is raised.
            # So instead we create a temporary holder for the modified dict
            # and then re-assign it afterwards.
            if isinstance(value, Collection):
                pass
            else:
                tmp[key] = value
        self.__dict__ = tmp
        data_dict = self.to_dict()

        # Remove any read-only attributes from our data_dict before we update
        # the data dict with the attributes.  If they pass in read-only attrs
        # in the method call we are going to let BIG-IP® let them know about it
        # when it fails
        for attr in read_only:
            data_dict.pop(attr, '')

        data_dict.update(kwargs)
        data_dict = self._prepare_request_json(data_dict)

        # Handles ConnectionAborted errors
        #
        # @see https://github.com/F5Networks/f5-ansible/issues/317
        # @see https://github.com/requests/requests/issues/2364
        for _ in range(0, 30):
            try:
                response = session.put(update_uri, json=data_dict, **requests_params)
                self._meta_data = temp_meta
                self._local_update(response.json())
                break
            except iControlUnexpectedHTTPError:
                response = session.get(update_uri, **requests_params)
                self._meta_data = temp_meta
                self._local_update(response.json())
                raise
            except ConnectionError as ex:
                if 'Connection aborted' in str(ex):
                    time.sleep(1)
                    continue
                else:
                    raise