Current Path : /compat/linux/proc/self/root/usr/local/lib/python2.5/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //compat/linux/proc/self/root/usr/local/lib/python2.5/rexec.pyo |
hRc @ s d Z d d k Z d d k Z d d k Z d d k Z d d k Z d g Z d f d YZ d e f d YZ d Z d e f d YZ d e i f d YZ e i Z e i Z d e i f d YZ d Z e d j o e i e n d S( s9 Restricted execution facilities. The class RExec exports methods r_exec(), r_eval(), r_execfile(), and r_import(), which correspond roughly to the built-in operations exec, eval(), execfile() and import, but executing the code in an environment that only exposes those built-in operations that are deemed safe. To this end, a modest collection of 'fake' modules is created which mimics the standard modules by the same names. It is a policy decision which built-in modules and operations are made available; this module provides a reasonable default, but derived classes can change the policies e.g. by overriding or extending class variables like ok_builtin_modules or methods like make_sys(). XXX To do: - r_open should allow writing tmp dir - r_exec etc. with explicit globals/locals? (Use rexec("exec ... in ...")?) iNt RExect FileBasec B s e Z d Z RS( t filenot flusht isattyt readt readlinet readlinest seekt tellt writet writelinest xreadlinest __iter__( s filenos flushs isattys reads readlines readliness seeks tells writes writeliness xreadliness __iter__( t __name__t __module__t ok_file_methods( ( ( s! /usr/local/lib/python2.5/rexec.pyR s t FileWrapperc B s e Z d Z d Z RS( c C sV xO | i D]D } t | | o- t | | o t | | t | | q q Wd S( N( R t hasattrt setattrt getattr( t selft ft m( ( s! /usr/local/lib/python2.5/rexec.pyt __init__( s !c C s | i d S( N( R ( R ( ( s! /usr/local/lib/python2.5/rexec.pyt close- s ( R R R R ( ( ( s! /usr/local/lib/python2.5/rexec.pyR $ s sL def %s(self, *args): return getattr(self.mod, self.name).%s(*args) t FileDelegatec B s; e Z d Z x' e i d D] Z e e e f d Uq WRS( c C s | | _ | | _ d S( N( t modt name( R R R ( ( s! /usr/local/lib/python2.5/rexec.pyR 8 s R N( s close( R R R R R R t TEMPLATE( ( ( s! /usr/local/lib/python2.5/rexec.pyR 6 s t RHooksc B s} e Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z RS( c G s d } d } | o5 t | d t d j o | d } | d } n | o, t | d d o | d } | d } n | o t d n t i i | | | | _ d S( Ni it __class__i s too many arguments( t Nonet typeR t TypeErrort ihookst HooksR t rexec( R t argst verboseR% ( ( s! /usr/local/lib/python2.5/rexec.pyR B s $ c C s | | _ d S( N( R% ( R R% ( ( s! /usr/local/lib/python2.5/rexec.pyt set_rexecS s c C s | i i S( N( R% t get_suffixes( R ( ( s! /usr/local/lib/python2.5/rexec.pyR) W s c C s | i i | S( N( R% t is_builtin( R R ( ( s! /usr/local/lib/python2.5/rexec.pyR* Z s c C s t | } | i i | d S( N( ( t __import__R% t copy_except( R R R ( ( s! /usr/local/lib/python2.5/rexec.pyt init_builtin] s c C s t d d S( Ns don't use this( t SystemError( R R ( ( s! /usr/local/lib/python2.5/rexec.pyt init_frozena s c G s t d d S( Ns don't use this( R. ( R R&