Module Expr Str Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias Import alias TryExcept body Import alias handlers ExceptHandler type NameLoad body Assign NameStore NameLoad FunctionDef arguments args defaults vararg kwarg body Raise Call NameLoad AttributeLoad NameLoad attr Str decorator_list FunctionDef arguments args defaults vararg kwarg body Return Num decorator_list FunctionDef arguments args defaults body Expr Str Return TupleLoad Str Str Str Str Str decorator_list FunctionDef arguments args NameParam defaults body Expr Str Return Call AttributeLoad Str attr GeneratorExp Call NameLoad Call AttributeLoad NameLoad attr Num Num comprehension NameStore Call NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults AttributeLoad NameLoad attr body Expr Str If BinOpBitAnd NameLoad BinOpBitOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Return NameLoad orelse If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Return NameLoad Return Call NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Num AttributeLoad NameLoad attr body Expr Str If BinOpBitAnd NameLoad BinOpBitOr BinOpBitOr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Raise Call NameLoad AttributeLoad NameLoad attr Str NameLoad orelse If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad AttributeLoad NameLoad attr Str NameLoad Return Call NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad AttributeLoad NameLoad attr body Expr Str If CompareNotIn NameLoad TupleLoad NameLoad Str Str Str body Raise Call AttributeLoad NameLoad attr Str Return Call NameLoad NameLoad Str decorator_list FunctionDef arguments args defaults body Expr Str If CompareEq AttributeLoad NameLoad attr Str body Return Str orelse Return Str decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore Call NameLoad ListLoad Str Str Str Str Assign NameStore Call NameLoad GeneratorExp Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad comprehension NameStore AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore Call NameLoad ListLoad Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr NameLoad If CompareIsNot NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr ListLoad Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If NameLoad body Expr Call AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore NameLoad Assign NameStore Dict Assign NameStore Call AttributeLoad NameLoad attr FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BinOpBitOr Call NameLoad GeneratorExp Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad comprehension NameStore NameLoad Call NameLoad GeneratorExp Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad comprehension NameStore NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr BinOpBitOr NameLoad AttributeLoad NameLoad attr With AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Dict decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad With AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Dict decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr NameLoad With AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Dict decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot Call NameLoad NameLoad NameLoad body Raise Call NameLoad Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad With AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If CompareIs NameLoad NameLoad body If BoolOpAnd Call NameLoad NameLoad ListLoad AttributeLoad NameLoad attr CompareNotEq NameLoad AttributeLoad NameLoad attr body Assign NameStore Call AttributeLoad SubscriptLoad NameLoad Slice Call NameLoad AttributeLoad NameLoad attr attr AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore BoolOpOr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad orelse Assign NameStore NameLoad Assign NameStore BoolOpAnd UnaryOpNot NameLoad BoolOpOr CompareIn NameLoad AttributeLoad NameLoad attr Call NameLoad NameLoad AttributeLoad NameLoad attr With AttributeLoad NameLoad attr body Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad Return NameLoad decorator_list NameLoad FunctionDef arguments args NameParam NameParam NameParam NameParam defaults Str Num kwarg body Expr Str If CompareNotIn NameLoad AttributeLoad NameLoad attr body Raise Call NameLoad AttributeLoad NameLoad attr Str NameLoad If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Raise Call NameLoad AttributeLoad NameLoad attr Str NameLoad Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults NameLoad body Expr Str Assign AttributeStore NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults vararg kwarg body Expr Str If UnaryOpNot Call AttributeLoad NameLoad attr NameLoad body Raise Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str NameLoad Return Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad decorator_list decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad For NameStore NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad If CompareEq Call AttributeLoad AttributeLoad NameLoad attr attr ListLoad NameLoad NameLoad NameLoad body Return NameLoad Return NameLoad decorator_list
N/A N/A Stub implementations of restricted functions. N/A errno N/A functools N/A inspect N/A locale N/A mimetypes N/A os N/A random N/A re N/A sys N/A threading N/A N/A N/A sysconfig N/A N/A N/A ImportError N/A N/A sysconfig None os_error_not_implemented N/A N/A N/A unused_args unused_kwargs N/A N/A N/A OSError N/A errno ENOSYS Function not implemented N/A return_minus_one N/A N/A N/A unused_args unused_kwargs N/A N/A -1 N/A fake_uname N/A N/A N/A N/A N/A Fake version of os.uname. N/A N/A Linux N/A fake_urandom N/A N/A n N/A N/A N/A Fake version of os.urandom. N/A N/A N/A join N/A N/A chr N/A N/A random randint 0 255 N/A _ N/A xrange n N/A fake_access N/A N/A path mode _os_access N/A N/A os access N/A N/A Fake version of os.access where only reads are supported. N/A N/A mode N/A N/A os W_OK N/A os X_OK N/A N/A False N/A N/A N/A N/A N/A FakeFile is_file_accessible path N/A N/A False N/A N/A _os_access path mode N/A fake_open N/A N/A filename flags mode _os_open N/A 511 N/A os open N/A N/A Fake version of os.open. N/A N/A flags N/A N/A N/A os O_RDWR N/A os O_CREAT N/A os O_WRONLY N/A N/A N/A OSError N/A errno EROFS Read-only file system filename N/A N/A N/A N/A N/A FakeFile is_file_accessible filename N/A N/A N/A OSError N/A errno ENOENT No such file or directory filename N/A N/A _os_open filename flags mode N/A fake_set_locale N/A N/A category value original_setlocale N/A None N/A locale setlocale N/A N/A Fake version of locale.setlocale that only supports the default. N/A N/A value N/A None C POSIX N/A N/A N/A N/A locale Error locale emulation only supports "C" locale N/A N/A original_setlocale category C N/A fake_get_platform N/A N/A N/A N/A N/A Fake distutils.util.get_platform(). N/A N/A N/A sys platform darwin N/A N/A macosx- N/A N/A linux- N/A FakeFile N/A file N/A N/A File sub-class that enforces the restrictions of production. N/A ALLOWED_MODES N/A frozenset N/A r rb U rU N/A ALLOWED_FILES N/A set N/A N/A N/A N/A os path normcase filename N/A filename N/A mimetypes knownfiles N/A N/A N/A os path isfile filename N/A ALLOWED_DIRS N/A set N/A N/A N/A N/A os path normcase N/A N/A N/A os path realpath N/A N/A N/A os path dirname N/A os __file__ N/A N/A N/A os path normcase N/A N/A N/A os path abspath N/A N/A N/A os path dirname N/A os __file__ N/A N/A N/A os path normcase N/A N/A N/A os path dirname N/A N/A N/A os path realpath N/A os __file__ N/A N/A N/A os path normcase N/A N/A N/A os path dirname N/A N/A N/A os path abspath N/A os __file__ N/A os_source_location N/A N/A inspect getsourcefile os N/A N/A os_source_location None N/A N/A N/A N/A ALLOWED_DIRS update N/A N/A N/A N/A os path normcase N/A N/A N/A os path realpath N/A N/A N/A os path dirname os_source_location N/A N/A N/A os path normcase N/A N/A N/A os path abspath N/A N/A N/A os path dirname os_source_location N/A N/A N/A os path normcase N/A N/A N/A os path dirname N/A N/A N/A os path realpath os_source_location N/A N/A N/A os path normcase N/A N/A N/A os path dirname N/A N/A N/A os path abspath os_source_location N/A sysconfig N/A N/A N/A N/A ALLOWED_DIRS add N/A N/A N/A os path dirname N/A N/A sysconfig get_config_h_filename N/A _allowed_dirs None N/A _skip_files None N/A _static_files None N/A _availability_cache N/A N/A _availability_cache_lock N/A N/A threading Lock set_allowed_paths N/A N/A root_path application_paths N/A N/A N/A Configures which paths are allowed to be accessed.

    Must be called at least once before any file objects are created in the
    hardened environment.

    Args:
      root_path: Absolute path to the root of the application.
      application_paths: List of additional paths that the application may
        access, this must include the App Engine runtime but not the Python
        library directories.
     N/A _application_paths N/A N/A set N/A N/A N/A N/A os path realpath path N/A path application_paths N/A set N/A N/A N/A N/A os path abspath path N/A path application_paths N/A N/A FakeFile _root_path N/A N/A N/A os path normcase N/A N/A N/A os path abspath root_path N/A N/A N/A _application_paths add N/A FakeFile _root_path N/A N/A FakeFile _allowed_dirs N/A _application_paths N/A FakeFile ALLOWED_DIRS N/A N/A FakeFile _availability_cache_lock N/A N/A N/A FakeFile _availability_cache N/A N/A staticmethod set_skip_files N/A N/A skip_files N/A N/A N/A Configure the skip_files regex.

    Files that match this regex are inaccessible in the hardened environment.
    Must be called at least once before any file objects are created in the
    hardened environment.

    Args:
      skip_files: A str containing a regex to match against file paths.
     N/A N/A FakeFile _skip_files N/A N/A re compile skip_files N/A N/A FakeFile _availability_cache_lock N/A N/A N/A FakeFile _availability_cache N/A N/A staticmethod set_static_files N/A N/A static_files N/A N/A N/A Configure the static_files regex.

    Files that match this regex are inaccessible in the hardened environment.
    Must be called at least once before any file objects are created in the
    hardened environment.

    Args:
      static_files: A str containing a regex to match against file paths.
     N/A N/A FakeFile _static_files N/A N/A re compile static_files N/A N/A FakeFile _availability_cache_lock N/A N/A N/A FakeFile _availability_cache N/A N/A staticmethod is_file_accessible N/A N/A filename N/A N/A N/A Determines if a file is accessible.

    set_allowed_paths(), set_skip_files() and SetStaticFileConfigMatcher() must
    be called before this method or else all file accesses will raise an error.

    Args:
      filename: Path of the file to check (relative or absolute). May be a
        directory, in which case access for files inside that directory will
        be checked.

    Returns:
      True if the file is accessible, False otherwise.

    Raises:
      TypeError: filename is not a basestring.
     N/A N/A N/A isinstance filename basestring N/A N/A N/A TypeError N/A fixed_filename N/A N/A N/A os path normcase N/A N/A N/A os path abspath filename N/A N/A FakeFile _availability_cache_lock N/A N/A result N/A N/A N/A FakeFile _availability_cache get fixed_filename N/A N/A result None N/A N/A N/A N/A _is_path_in_directories fixed_filename N/A N/A FakeFile _root_path N/A fixed_filename N/A FakeFile _root_path N/A N/A relative_filename N/A N/A N/A fixed_filename N/A N/A len N/A FakeFile _root_path lstrip N/A N/A os path sep N/A block_access N/A N/A N/A N/A FakeFile _skip_files match relative_filename N/A N/A N/A FakeFile _static_files match relative_filename N/A N/A block_access False N/A result N/A N/A block_access N/A N/A fixed_filename N/A FakeFile ALLOWED_FILES N/A _is_path_in_directories fixed_filename N/A FakeFile _allowed_dirs N/A N/A FakeFile _availability_cache_lock N/A N/A N/A N/A FakeFile _availability_cache N/A fixed_filename result N/A result N/A staticmethod __init__ N/A N/A self filename mode bufsize N/A r -1 kwargs N/A N/A Initializer. See file built-in documentation. N/A N/A mode N/A FakeFile ALLOWED_MODES N/A N/A N/A IOError N/A errno EROFS Read-only file system filename N/A N/A N/A N/A FakeFile is_file_accessible filename N/A N/A N/A IOError N/A errno EACCES file not accessible filename N/A N/A N/A N/A super FakeFile self __init__ filename mode bufsize kwargs N/A N/A RestrictedPathFunction N/A object N/A N/A Enforces restrictions for functions with a path as their first argument. __init__ N/A N/A self original_func error_class N/A OSError N/A N/A Initializer.

    Args:
      original_func: Callable that takes as its first argument the path to a
        file or directory on disk; all subsequent arguments may be variable.
      error_class: The class of the error to raise when the file is not
        accessible.
     N/A N/A self _original_func original_func N/A N/A N/A functools update_wrapper self original_func N/A N/A self _error_class error_class N/A __call__ N/A N/A self path N/A args kwargs N/A N/A Enforces access permissions for the wrapped function. N/A N/A N/A N/A FakeFile is_file_accessible path N/A N/A N/A N/A self _error_class N/A errno EACCES path not accessible path N/A N/A N/A self _original_func path args kwargs N/A N/A _is_path_in_directories N/A N/A filename directories N/A N/A N/A Determines if a filename is contained within one of a set of directories.

  Args:
    filename: Path of the file (relative or absolute).
    directories: Iterable collection of paths to directories which the
      given filename may be under.

  Returns:
    True if the supplied filename is in one of the given sub-directories or
    its hierarchy of children. False otherwise.
   N/A fixed_path N/A N/A N/A os path normcase N/A N/A N/A os path abspath filename N/A parent directories N/A N/A fixed_parent N/A N/A N/A os path normcase N/A N/A N/A os path abspath parent N/A N/A N/A N/A N/A os path commonprefix N/A fixed_path fixed_parent fixed_parent N/A N/A True N/A False N/A