Removes given pattern from the Model.

        :param pattern: Pattern.
        :type pattern: unicode
        :return: Method success.
        :rtype: bool
359161
def remove_pattern(self, pattern):
        

        for index, node in enumerate(self.root_node.children):
            if node.name != pattern:
                continue

            LOGGER.debug("> Removing '{0}' at '{1}' index.".format(pattern, index))

            self.beginRemoveRows(self.get_node_index(self.root_node), index, index)
            pattern_node = self.root_node.child(index)
            self.root_node.remove_child(index)
            self.endRemoveRows()
            self.pattern_removed.emit(pattern_node)
            return True
1175283
def can_match(cls, pattern: Pattern) -> bool:
        
        if not isinstance(pattern.expression, Operation) or isinstance(pattern.expression, CommutativeOperation):
            return False

        if op_len(pattern.expression) < 3:
            return False

        first, *_, last = op_iter(pattern.expression)

        try:
            cls._check_wildcard_and_get_name(first)
            cls._check_wildcard_and_get_name(last)
        except ValueError:
            return False

        return True
1272062
public boolean removeFactPattern( int index ) {
        final int newSize = ( ( index >= 0 && index < this.patterns.length ) ? this.patterns.length - 1 : this.patterns.length );
        final IFactPattern[] newList = new IFactPattern[ newSize ];
        boolean deleted = false;
        int newIdx = 0;
        for ( int i = 0; i < this.patterns.length; i++ ) {
            if ( i != index ) {
                newList[ newIdx ] = this.patterns[ i ];
                newIdx++;
            } else {
                deleted = true;
            }
        }
        this.patterns = newList;
        return deleted;
    }
533543
def re_get(self, pattern):
        
        return {k: self[k] for k in self.re_keys(pattern)}
1175311
public void removeTarget(T target) {
    Iterator<Pattern<T>> it = patterns.iterator();
    while (it.hasNext()) {
      Pattern<T> pattern = it.next();
      if (pattern.target().equals(target)) it.remove();
    }

    reverse.remove(target);
  }
1104472
def transform(pattern):
    
    result = []
    groups = [[pattern]]
    while groups:
        children = groups.pop(0)
        parents = [Required, Optional, OptionsShortcut, Either, OneOrMore]
        if any(t in map(type, children) for t in parents):
            child = [c for c in children if type(c) in parents][0]
            children.remove(child)
            if type(child) is Either:
                for c in child.children:
                    groups.append([c] + children)
            elif type(child) is OneOrMore:
                groups.append(child.children * 2 + children)
            else:
                groups.append(child.children + children)
        else:
            result.append(children)
    return Either(*[Required(*e) for e in result])
217936
def _filter_data(self, pattern):
        '''
        
        '''
        removed = []
        filtered = []
        for param in self.data:
            if not param[0].startswith(pattern):
                filtered.append(param)
            else:
                removed.append(param)
        self.data = filtered
        return removed
37573
def recursive_exclude(self, dir, pattern):
        
        match = translate_pattern(os.path.join(dir, '**', pattern))
        return self._remove_files(match.match)
1001332
def re_keys(self, pattern):
        
        if not pattern.endswith("$"):
            pattern += "$"
        expr = re.compile(pattern)
        return list(filter(expr.match, self.keys()))
546823
def _match_and_pop(self, regex_pattern):
        
        results = []
        self.lock.acquire()
        for name in self.event_dict.keys():
            if re.match(regex_pattern, name):
                q = self.event_dict[name]
                if q:
                    try:
                        results.append(q.get(False))
                    except:
                        pass
        self.lock.release()
        return results
899980
def _handle_extract_pattern(self, pattern):
        ''''''
        if pattern is None or not pattern:
            patterns = []
        elif isinstance(pattern, str):
            patterns = [pattern]
        elif isinstance(pattern, Iterable):
            patterns = pattern
        else:
            raise ValueError(
                f'Unacceptable value for parameter pattern: {pattern}')
        #
        for pattern in patterns:
            res = extract_pattern(pattern, self._targets)
            self.set(**res)
            # also make k, v pair with _input
            self._handle_paired_with({'_' + x: y for x, y in res.items()})
710477
def delete_key_pattern(obj, regx_pattern):
    '''  '''

    if isinstance(obj, list):
        _return_list = []
        for item in obj:
            if isinstance(item, list):
                _return_list.append(delete_key_pattern(item, regx_pattern))
            elif isinstance(item, set):
                _return_list.append(list(item))
            elif isinstance(item, dict):
                _return_list.append(delete_key_pattern(item, regx_pattern))
            else:
                try:
                    json.dumps(item)
                    _return_list.append(item)
                except:
                    _return_list.append(str(type(item)))
        return _return_list
    elif isinstance(obj, set):
        return list(obj)
    elif isinstance(obj, dict):
        _return_obj = {}
        for key, item in obj.items():
            if not re.match(regx_pattern, key):
                if isinstance(item, list):
                    _return_obj[key] = delete_key_pattern(item, regx_pattern)
                elif isinstance(item, set):
                    _return_obj[key] = list(item)
                elif isinstance(item, dict):
                    _return_obj[key] = delete_key_pattern(item, regx_pattern)
                else:
                    try:
                        json.dumps(item)
                        _return_obj[key] = item
                    except:
                        _return_obj[key] = str(type(item))
        return _return_obj
    else:
        try:
            json.dumps(obj)
            return obj
        except:
            return str(type(obj))
286105
def regex(self, *pattern, **kwargs):
        
        self.pattern(self.build_re(*pattern, **kwargs))
        return self
860742
def simple_pattern(self, pattern, field=None):
        
        return self.get_allowed_value(lambda: self.faker.bothify(pattern), field)
1048471
@Deprecated
    public void setPattern(Pattern pattern) {
        patterns = new ArrayList<Pattern>(1);
        patterns.add(pattern);
    }
213256
def remove_html_tag(input_str='', tag=None):
    
    result = input_str
    if tag is not None:
        pattern = re.compile('<{tag}[\s\S]+?/{tag}>'.format(tag=tag))
        result = re.sub(pattern, '', str(input_str))

    return result
75985
def recursive_pattern_delete(root, file_patterns, directory_patterns, dry_run=False):
    """"""
    for root, dirs, files in os.walk(root):
        for pattern in file_patterns:
            for file_name in fnmatch.filter(files, pattern):
                file_path = os.path.join(root, file_name)
                if dry_run:
                    print_('Removing {}'.format(file_path))
                    continue
                os.remove(file_path)

        for pattern in directory_patterns:
            for found_dir in fnmatch.filter(dirs, pattern):
                if os.path.exists(found_dir):
                    if dry_run:
                        print('Removing directory tree {}'.format(found_dir))
                        continue
                    shutil.rmtree(found_dir)