Server IP : 103.119.228.120 / Your IP : 18.188.183.21 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/lib/mysqlsh/lib/python3.9/site-packages/pip/_vendor/resolvelib/ |
Upload File : |
import itertools from .compat import collections_abc class DirectedGraph(object): """A graph structure with directed edges.""" def __init__(self): self._vertices = set() self._forwards = {} # <key> -> Set[<key>] self._backwards = {} # <key> -> Set[<key>] def __iter__(self): return iter(self._vertices) def __len__(self): return len(self._vertices) def __contains__(self, key): return key in self._vertices def copy(self): """Return a shallow copy of this graph.""" other = DirectedGraph() other._vertices = set(self._vertices) other._forwards = {k: set(v) for k, v in self._forwards.items()} other._backwards = {k: set(v) for k, v in self._backwards.items()} return other def add(self, key): """Add a new vertex to the graph.""" if key in self._vertices: raise ValueError("vertex exists") self._vertices.add(key) self._forwards[key] = set() self._backwards[key] = set() def remove(self, key): """Remove a vertex from the graph, disconnecting all edges from/to it.""" self._vertices.remove(key) for f in self._forwards.pop(key): self._backwards[f].remove(key) for t in self._backwards.pop(key): self._forwards[t].remove(key) def connected(self, f, t): return f in self._backwards[t] and t in self._forwards[f] def connect(self, f, t): """Connect two existing vertices. Nothing happens if the vertices are already connected. """ if t not in self._vertices: raise KeyError(t) self._forwards[f].add(t) self._backwards[t].add(f) def iter_edges(self): for f, children in self._forwards.items(): for t in children: yield f, t def iter_children(self, key): return iter(self._forwards[key]) def iter_parents(self, key): return iter(self._backwards[key]) class IteratorMapping(collections_abc.Mapping): def __init__(self, mapping, accessor, appends=None): self._mapping = mapping self._accessor = accessor self._appends = appends or {} def __repr__(self): return "IteratorMapping({!r}, {!r}, {!r})".format( self._mapping, self._accessor, self._appends, ) def __bool__(self): return bool(self._mapping or self._appends) __nonzero__ = __bool__ # XXX: Python 2. def __contains__(self, key): return key in self._mapping or key in self._appends def __getitem__(self, k): try: v = self._mapping[k] except KeyError: return iter(self._appends[k]) return itertools.chain(self._accessor(v), self._appends.get(k, ())) def __iter__(self): more = (k for k in self._appends if k not in self._mapping) return itertools.chain(self._mapping, more) def __len__(self): more = sum(1 for k in self._appends if k not in self._mapping) return len(self._mapping) + more class _FactoryIterableView(object): """Wrap an iterator factory returned by `find_matches()`. Calling `iter()` on this class would invoke the underlying iterator factory, making it a "collection with ordering" that can be iterated through multiple times, but lacks random access methods presented in built-in Python sequence types. """ def __init__(self, factory): self._factory = factory def __repr__(self): return "{}({})".format(type(self).__name__, list(self._factory())) def __bool__(self): try: next(self._factory()) except StopIteration: return False return True __nonzero__ = __bool__ # XXX: Python 2. def __iter__(self): return self._factory() class _SequenceIterableView(object): """Wrap an iterable returned by find_matches(). This is essentially just a proxy to the underlying sequence that provides the same interface as `_FactoryIterableView`. """ def __init__(self, sequence): self._sequence = sequence def __repr__(self): return "{}({})".format(type(self).__name__, self._sequence) def __bool__(self): return bool(self._sequence) __nonzero__ = __bool__ # XXX: Python 2. def __iter__(self): return iter(self._sequence) def build_iter_view(matches): """Build an iterable view from the value returned by `find_matches()`.""" if callable(matches): return _FactoryIterableView(matches) if not isinstance(matches, collections_abc.Sequence): matches = list(matches) return _SequenceIterableView(matches)