Module Import alias Import alias Import alias Import alias Import alias Import alias Import alias alias Import alias identifier ImportFrom alias Import alias Import alias identifier ImportFrom alias Assign NameStore Call AttributeLoad NameLoad attr NameLoad FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad Str attr decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults NameLoad NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr Str ListLoad Assign AttributeStore NameLoad attr NameLoad If CompareNotIn Str NameLoad body If CompareIn Str NameLoad body Assign AttributeStore NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Assign NameStore NameLoad If BoolOpAnd CompareIsNot NameLoad NameLoad CompareIsNot NameLoad NameLoad body Raise Call AttributeLoad NameLoad attr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If UnaryOpNot AttributeLoad NameLoad attr body Return Assign AttributeStore NameLoad attr NameLoad Assign NameStore IfExp AttributeLoad NameLoad attr Str Str If CompareIs NameLoad NameLoad body If CompareIsNot NameLoad NameLoad body Assign NameStore BinOpAdd NameLoad NameLoad orelse With Call AttributeLoad NameLoad attr keyword NameLoad keyword NameLoad NameStore body Assign NameStore AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr If CompareNotEq NameLoad NameLoad body Assign NameStore IfExp AttributeLoad NameLoad attr Str Str Raise Call AttributeLoad NameLoad attr Call AttributeLoad Str attr AttributeLoad NameLoad attr NameLoad NameLoad Expr Call NameLoad NameLoad Assign AttributeStore NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Str Num Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr BoolOpOr NameLoad Dict Assign SubscriptStore AttributeLoad NameLoad attr Index Str IfExp AttributeLoad NameLoad attr Str Str Assign AttributeStore NameLoad attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return BoolOpAnd AttributeLoad NameLoad attr UnaryOpNot AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Return Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Assign NameStore IfExp AttributeLoad NameLoad attr Str Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr keyword NameLoad If CompareIs NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str If UnaryOpNot AttributeLoad NameLoad attr body Return If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Assign AttributeStore NameLoad attr NameLoad orelse Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr Dict Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad If AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr If Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr If CompareIs AttributeLoad NameLoad attr NameLoad body Assign AttributeStore NameLoad attr Dict Assign SubscriptStore AttributeLoad NameLoad attr Index Str NameLoad Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body With Call NameLoad AttributeLoad NameLoad attr Str NameStore body Expr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index Str AttributeLoad AttributeLoad NameLoad attr attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot AttributeLoad NameLoad attr body Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign SubscriptStore AttributeLoad NameLoad attr Index Str AttributeLoad AttributeLoad NameLoad attr attr TryExcept body Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad handlers ExceptHandler type AttributeLoad NameLoad attr name NameStore body Expr Call AttributeLoad NameLoad attr Str NameLoad Assign AttributeStore NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr ListLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Assign NameStore NameLoad If Call NameLoad NameLoad NameLoad body Assign NameStore NameLoad orelse If Call NameLoad NameLoad NameLoad body Assign NameStore Call AttributeLoad NameLoad attr orelse Raise Call AttributeLoad NameLoad attr Call AttributeLoad Str attr Call NameLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Str If CompareNotEq SubscriptLoad NameLoad Slice Num Call AttributeLoad NameLoad attr Str body Raise Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad If CompareIn Call AttributeLoad NameLoad attr Str NameLoad body Raise Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Assign NameStore Num Assign NameStore Call AttributeLoad NameLoad attr BinOpMod Str Num Assign NameStore ListComp TupleLoad NameLoad Call AttributeLoad BinOpAdd NameLoad Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str Call AttributeLoad NameLoad attr Str attr Str comprehension NameStore AttributeLoad NameLoad attr Assign NameStore BinOpAdd Call NameLoad ListComp Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str comprehension NameStore AttributeLoad NameLoad attr Num Assign NameStore BinOpAdd Call NameLoad ListComp Call NameLoad ListComp Call NameLoad NameLoad comprehension NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr Str comprehension NameStore AttributeLoad NameLoad attr Num Assign NameStore Dict Str Str Str Str Str Str Str Str Num NameLoad NameLoad BinOpMult Call NameLoad AttributeLoad NameLoad attr NameLoad Str Str Dict NameLoad With Call NameLoad AttributeLoad NameLoad attr Str NameStore body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad decorator_list FunctionDef arguments args NameParam defaults body Return Dict Str Str Str Num decorator_list NameLoad decorator_list ClassDef bases NameLoad body FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign TupleStore NameStore NameStore NameStore NameLoad If BoolOpAnd CompareNotEq NameLoad Num CompareNotEq NameLoad Num body Raise Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad Assign AttributeStore NameLoad attr TupleLoad NameLoad NameLoad Assign AttributeStore NameLoad attr CompareEq NameLoad Num Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad If CompareIsNot Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad body Assign AttributeStore NameLoad attr Str orelse If CompareIsNot Call AttributeLoad AttributeLoad NameLoad attr attr Str NameLoad body Assign AttributeStore NameLoad attr Str orelse Raise Call AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Return Dict Str Str Str AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr ListLoad AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr decorator_list NameLoad FunctionDef arguments args NameParam defaults body Assign AttributeStore NameLoad attr TupleLoad AttributeLoad NameLoad attr Str Str Str Str Str BinOpMod Str AttributeLoad NameLoad attr Str Str Str Call AttributeLoad Str attr AttributeLoad NameLoad attr Str IfExp AttributeLoad NameLoad attr Str Str Str Str Str Str Str Str AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str Call AttributeLoad Str attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam NameParam defaults body If UnaryOpNot Call NameLoad NameLoad TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Raise Call AttributeLoad NameLoad attr Call AttributeLoad Str attr Call NameLoad NameLoad NameLoad If CompareNotEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Raise Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad AttributeLoad NameLoad attr If CompareNotEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body Raise Call AttributeLoad NameLoad attr Call AttributeLoad Str attr AttributeLoad NameLoad attr If CompareGtE Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Call AttributeLoad AttributeLoad NameLoad attr attr Str body Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Call AttributeLoad NameLoad attr orelse Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr If CompareNotEq NameLoad Num body Expr Call AttributeLoad NameLoad attr Call AttributeLoad Str attr NameLoad decorator_list decorator_list
N/A N/A logging N/A json N/A os N/A subprocess N/A tempfile N/A os.path N/A distutils.spawn distutils.version N/A numpy np six StringIO N/A six N/A six.moves.urllib urlparse gym error N/A logger N/A N/A logging getLogger __name__ touch N/A N/A path N/A N/A N/A N/A N/A N/A open path a close N/A VideoRecorder N/A object N/A N/A VideoRecorder renders a nice movie of a rollout, frame by frame. It
    comes with an `enabled` option so you can still use the same code
    on episodes where you don't want to record video.

    Note:
        You are responsible for calling `close` on a created
        VideoRecorder, or else you may leak an encoder process.

    Args:
        env (Env): Environment to take video of.
        path (Optional[str]): Path to the video file; will be randomly chosen if omitted.
        base_path (Optional[str]): Alternatively, path to the video file without extension, which will be added.
        metadata (Optional[dict]): Contents to save to the metadata file.
        enabled (bool): Whether to actually record video, or just no-op (for convenience)
     __init__ N/A N/A self env path metadata enabled base_path N/A None None True None N/A N/A modes N/A N/A N/A env metadata get render.modes N/A N/A N/A self ansi_mode False N/A N/A rgb_array modes N/A N/A N/A ansi modes N/A N/A N/A self ansi_mode True N/A N/A N/A N/A logger info N/A N/A Disabling video recorder because {} neither supports video mode "rgb_array" nor "ansi". format env N/A enabled False N/A N/A N/A path None N/A base_path None N/A N/A N/A N/A error Error You can pass at most one of `path` or `base_path`. N/A N/A self enabled enabled N/A N/A self last_frame None N/A N/A N/A self enabled N/A N/A N/A N/A self env env N/A required_ext N/A N/A self ansi_mode .json .mp4 N/A N/A path None N/A N/A N/A base_path None N/A N/A path N/A base_path required_ext N/A N/A N/A N/A tempfile NamedTemporaryFile suffix required_ext delete False f N/A N/A path N/A f name N/A N/A self path path N/A N/A path_base actual_ext N/A N/A N/A os path splitext N/A self path N/A N/A actual_ext required_ext N/A N/A hint N/A N/A self ansi_mode  HINT: The environment is text-only, therefore we're recording its text output in a structured JSON format. N/A N/A N/A error Error N/A N/A Invalid path given: {} -- must have file extension {}.{} format N/A self path required_ext hint N/A N/A touch path N/A N/A self frames_per_sec N/A N/A N/A env metadata get video.frames_per_second 30 N/A N/A self encoder None N/A N/A self broken False N/A N/A self metadata N/A metadata N/A N/A N/A N/A self metadata N/A content_type N/A N/A self ansi_mode video/vnd.openai.ansivid video/mp4 N/A N/A self metadata_path N/A N/A {}.meta.json format path_base N/A N/A N/A self write_metadata N/A N/A N/A logger info Starting new video recorder writing to %s N/A self path N/A N/A self empty True N/A functional N/A N/A self N/A N/A N/A N/A N/A self enabled N/A N/A self broken N/A property capture_frame N/A N/A self N/A N/A N/A Render the given `env` and add the resulting frame to the video. N/A N/A N/A self functional N/A N/A N/A N/A N/A logger debug Capturing video frame: path=%s N/A self path N/A render_mode N/A N/A self ansi_mode ansi rgb_array N/A frame N/A N/A N/A self env render mode render_mode N/A N/A frame None N/A N/A N/A N/A logger warn Env returned None on render(). Disabling further rendering for video recorder by marking as disabled: path=%s metadata_path=%s N/A self path N/A self metadata_path N/A N/A self broken True N/A N/A N/A self last_frame frame N/A N/A self ansi_mode N/A N/A N/A N/A self _encode_ansi_frame frame N/A N/A N/A N/A self _encode_image_frame frame N/A close N/A N/A self N/A N/A N/A Make sure to manually close, or else you'll leak the encoder process N/A N/A N/A self enabled N/A N/A N/A N/A self encoder N/A N/A N/A N/A logger debug Closing video encoder: path=%s N/A self path N/A N/A N/A N/A self encoder close N/A N/A self encoder None N/A N/A N/A N/A os remove N/A self path N/A N/A N/A self metadata None N/A N/A N/A self metadata N/A N/A N/A N/A self metadata N/A empty True N/A N/A self broken N/A N/A N/A N/A logger info Cleaning up paths for broken video recorder: path=%s metadata_path=%s N/A self path N/A self metadata_path N/A N/A N/A N/A os path exists N/A self path N/A N/A N/A N/A os remove N/A self path N/A N/A N/A self metadata None N/A N/A N/A self metadata N/A N/A N/A N/A self metadata N/A broken True N/A N/A N/A self write_metadata N/A write_metadata N/A N/A self N/A N/A N/A N/A open N/A self metadata_path w f N/A N/A N/A N/A json dump N/A self metadata f N/A _encode_ansi_frame N/A N/A self frame N/A N/A N/A N/A N/A self encoder N/A N/A N/A self encoder N/A TextEncoder N/A self path N/A self frames_per_sec N/A N/A N/A self metadata N/A encoder_version N/A N/A self encoder version_info N/A N/A N/A N/A self encoder capture_frame frame N/A N/A self empty False N/A _encode_image_frame N/A N/A self frame N/A N/A N/A N/A N/A self encoder N/A N/A N/A self encoder N/A ImageEncoder N/A self path N/A frame shape N/A self frames_per_sec N/A N/A N/A self metadata N/A encoder_version N/A N/A self encoder version_info N/A N/A N/A N/A N/A N/A self encoder capture_frame frame N/A N/A N/A N/A error InvalidFrame N/A e N/A N/A N/A N/A logger warn Tried to pass invalid video frame, marking as broken: %s e N/A N/A self broken True N/A N/A N/A self empty False N/A N/A TextEncoder N/A object N/A N/A Store a moving picture made out of ANSI frames. Format adapted from
    https://github.com/asciinema/asciinema/blob/master/doc/asciicast-v1.md __init__ N/A N/A self output_path frames_per_sec N/A N/A N/A N/A self output_path output_path N/A N/A self frames_per_sec frames_per_sec N/A N/A self frames N/A N/A capture_frame N/A N/A self frame N/A N/A N/A string None N/A N/A isinstance frame str N/A N/A string frame N/A N/A N/A isinstance frame StringIO N/A N/A string N/A N/A frame getvalue N/A N/A N/A N/A error InvalidFrame N/A N/A Wrong type {} for {}: text frame must be a string or StringIO format N/A type frame frame N/A frame_bytes N/A N/A string encode utf-8 N/A N/A N/A frame_bytes N/A -1 N/A N/A six b N/A N/A N/A N/A error InvalidFrame N/A N/A Frame must end with a newline: """{}""" format string N/A N/A N/A N/A six b frame_bytes N/A N/A N/A N/A error InvalidFrame N/A N/A Frame contains carriage returns (only newlines are allowed: """{}""" format string N/A N/A N/A N/A self frames append frame_bytes N/A close N/A N/A self N/A N/A N/A frame_duration 0.5 N/A clear_code N/A N/A six b N/A %c[2J[1;1H 27 N/A events N/A N/A frame_duration N/A N/A N/A clear_code N/A N/A frame replace N/A N/A six b N/A N/A six b decode utf-8 N/A frame N/A self frames N/A height N/A N/A max N/A N/A N/A frame count N/A N/A six b N/A frame N/A self frames 1 N/A width N/A N/A max N/A N/A max N/A N/A len line N/A line N/A N/A frame split N/A N/A six b N/A frame N/A self frames 2 N/A data N/A version width height duration command title env stdout 1 width height N/A N/A len N/A self frames frame_duration - gym VideoRecorder episode N/A events N/A N/A open N/A self output_path w f N/A N/A N/A N/A json dump data f N/A version_info N/A N/A self N/A N/A N/A N/A backend version TextEncoder 1 N/A property N/A ImageEncoder N/A object N/A __init__ N/A N/A self output_path frame_shape frames_per_sec N/A N/A N/A N/A self proc None N/A N/A self output_path output_path N/A N/A h w pixfmt frame_shape N/A N/A N/A pixfmt 3 N/A pixfmt 4 N/A N/A N/A N/A error InvalidFrame N/A N/A Your frame has shape {}, but we require (w,h,3) or (w,h,4), i.e. RGB values for a w-by-h image, with an optional alpha channl. format frame_shape N/A N/A self wh N/A w h N/A N/A self includes_alpha N/A pixfmt 4 N/A N/A self frame_shape frame_shape N/A N/A self frames_per_sec frames_per_sec N/A N/A N/A N/A N/A distutils spawn find_executable ffmpeg None N/A N/A N/A self backend ffmpeg N/A N/A N/A N/A N/A N/A distutils spawn find_executable avconv None N/A N/A N/A self backend avconv N/A N/A N/A N/A error DependencyNotInstalled Found neither the ffmpeg nor avconv executables. On OS X, you can install ffmpeg via `brew install ffmpeg`. On most Ubuntu variants, `sudo apt-get install ffmpeg` should do it. On Ubuntu 14.04, however, you'll need to install avconv with `sudo apt-get install libav-tools`. N/A N/A N/A self start N/A version_info N/A N/A self N/A N/A N/A N/A backend version cmdline N/A self backend N/A N/A subprocess check_output N/A N/A self backend -version N/A self cmdline N/A property start N/A N/A self N/A N/A N/A N/A self cmdline N/A N/A self backend -nostats -loglevel error -y -r N/A %d N/A self frames_per_sec -f rawvideo -s:v N/A N/A {}x{} format N/A self wh -pix_fmt N/A N/A self includes_alpha rgb32 rgb24 -i /dev/stdin -vcodec libx264 -pix_fmt yuv420p N/A self output_path N/A N/A N/A logger debug Starting ffmpeg with "%s" N/A N/A join N/A self cmdline N/A N/A self proc N/A N/A subprocess Popen N/A self cmdline stdin N/A subprocess PIPE N/A capture_frame N/A N/A self frame N/A N/A N/A N/A N/A isinstance frame N/A N/A np ndarray N/A np generic N/A N/A N/A N/A error InvalidFrame N/A N/A Wrong type {} for {} (must be np.ndarray or np.generic) format N/A type frame frame N/A N/A N/A frame shape N/A self frame_shape N/A N/A N/A N/A error InvalidFrame N/A N/A Your frame has shape {}, but the VideoRecorder is configured for shape {}. format frame_shape N/A self frame_shape N/A N/A N/A frame dtype N/A np uint8 N/A N/A N/A N/A error InvalidFrame N/A N/A Your frame has data type {}, but we require uint8 (i.e. RGB values from 0-255). format N/A frame dtype N/A N/A N/A N/A N/A distutils version StrictVersion N/A np __version__ N/A N/A N/A distutils version StrictVersion 1.9.0 N/A N/A N/A N/A N/A N/A self proc stdin write N/A N/A frame tobytes N/A N/A N/A N/A N/A N/A self proc stdin write N/A N/A frame tostring N/A close N/A N/A self N/A N/A N/A N/A N/A N/A N/A self proc stdin close N/A ret N/A N/A N/A self proc wait N/A N/A ret 0 N/A N/A N/A N/A logger error N/A N/A VideoRecorder encoder exited with status {} format ret N/A N/A