uawdijnntqw1x1x1
IP : 52.15.207.126
Hostname : axolotl
Kernel : Linux axolotl 4.9.0-13-amd64 #1 SMP Debian 4.9.228-1 (2020-07-05) x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
OS : Linux
PATH:
/
var
/
..
/
..
/
usr
/
src
/
..
/
lib
/
python3
/
dist-packages
/
reportbug
/
hiermatch.py
/
/
# hiermatch - Doing match on a list of string or a hierarchy. # Written by Chris Lawrence <lawrencc@debian.org> # Copyright (C) 1999-2008 Chris Lawrence # Copyright (C) 2008-2017 Sandro Tosi <morph@debian.org> import re from . import exceptions def egrep_list(strlist, pattern_str, subindex=None): """Use the pattern_str to find any match in a list of strings.""" """Return: a list of index for the matchs into the origin list.""" if strlist is None: return None try: pat = re.compile(pattern_str, re.I | re.M) except: raise exceptions.InvalidRegex resultlist = [] if subindex is None: subindex = list(range(len(strlist))) for i in subindex: if pat.search(strlist[i]): resultlist.append(i) return resultlist def egrep_hierarchy(hier, pattern_str, subhier=None, nth=1): """Grep the nth item of a hierarchy [(x, [a, b]),...].""" """Return a subhier like [[n, m],[],...], n, m string index.""" resulthier = [] for i in range(len(hier)): if subhier: if subhier[i]: # Only if have something to match. resultlist = egrep_list(hier[i][nth], pattern_str, subhier[i]) else: resultlist = [] else: resultlist = egrep_list(hier[i][nth], pattern_str) resulthier.append(resultlist) return resulthier def matched_hierarchy(hier, pattern_str): """Actually create a new hierarchy from a pattern matching.""" mhier = [] result = egrep_hierarchy(hier, pattern_str) for i in range(len(result)): if result[i]: item = [hier[i][1][y] for y in result[i]] mhier.append((hier[i][0], item)) return mhier # vim:ts=8:sw=4:expandtab:
/var/../../usr/src/../lib/python3/dist-packages/reportbug/hiermatch.py