Server IP : 127.0.0.2 / Your IP : 3.144.103.205 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,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,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/python2.7/dist-packages/ldap/schema/ |
Upload File : |
""" ldap.schema.tokenizer - Low-level parsing functions for schema element strings See http://www.python-ldap.org/ for details. \$Id: tokenizer.py,v 1.13 2009/04/29 18:13:55 stroeder Exp $ """ def split_tokens(s,keywordDict): """ Returns list of syntax elements with quotes and spaces stripped. """ result = [] result_append = result.append s_len = len(s) i = 0 while i<s_len: start = i while i<s_len and s[i]!="'": if s[i]=="(" or s[i]==")": if i>start: result_append(s[start:i]) result_append(s[i]) i +=1 # Consume parentheses start = i elif s[i]==" " or s[i]=="$": if i>start: result_append(s[start:i]) i +=1 # Consume more space chars while i<s_len and s[i]==" ": i +=1 start = i else: i +=1 if i>start: result_append(s[start:i]) i +=1 if i>=s_len: break start = i while i<s_len and s[i]!="'": i +=1 if i>=start: result_append(s[start:i]) i +=1 return result # split_tokens() def extract_tokens(l,known_tokens): """ Returns dictionary of known tokens with all values """ assert l[0].strip()=="(" and l[-1].strip()==")",ValueError(l) result = {} result_has_key = result.has_key result.update(known_tokens) i = 0 l_len = len(l) while i<l_len: if result_has_key(l[i]): token = l[i] i += 1 # Consume token if i<l_len: if result_has_key(l[i]): # non-valued result[token] = (()) elif l[i]=="(": # multi-valued i += 1 # Consume left parentheses start = i while i<l_len and l[i]!=")": i += 1 result[token] = tuple(filter(lambda v:v!='$',l[start:i])) i += 1 # Consume right parentheses else: # single-valued result[token] = l[i], i += 1 # Consume single value else: i += 1 # Consume unrecognized item return result