# Path: Xlib/display.py
# class _BaseDisplay(protocol_display.Display):
# class Display(object):
#     def __init__(self, *args, **keys):
#     def get_atom(self, atomname, only_if_exists=0):
#     def __init__(self, display = None):
#     def get_display_name(self):
#     def fileno(self):
#     def close(self):
#     def set_error_handler(self, handler):
#     def flush(self):
#     def sync(self):
#     def next_event(self):
#     def pending_events(self):
#     def has_extension(self, extension):
#     def create_resource_object(self, type, id):
#     def __getattr__(self, attr):
#     def screen(self, sno = None):
#     def screen_count(self):
#     def get_default_screen(self):
#     def extension_add_method(self, object, name, function):
#     def extension_add_event(self, code, evt, name = None):
#     def extension_add_subevent(self, code, subcode, evt, name = None):
#     def add_extension_error(self, code, err):
#     def keycode_to_keysym(self, keycode, index):
#     def keysym_to_keycode(self, keysym):
#     def keysym_to_keycodes(self, keysym):
#     def refresh_keyboard_mapping(self, evt):
#     def _update_keymap(self, first_keycode, count):
#     def lookup_string(self, keysym):
#     def rebind_string(self, keysym, newstring):
#     def intern_atom(self, name, only_if_exists = 0):
#     def get_atom(self, atom, only_if_exists = 0):
#     def get_atom_name(self, atom):
#     def get_selection_owner(self, selection):
#     def send_event(self, destination, event, event_mask = 0, propagate = 0,
#                    onerror = None):
#     def ungrab_pointer(self, time, onerror = None):
#     def change_active_pointer_grab(self, event_mask, cursor, time, onerror = None):
#     def ungrab_keyboard(self, time, onerror = None):
#     def allow_events(self, mode, time, onerror = None):
#     def grab_server(self, onerror = None):
#     def ungrab_server(self, onerror = None):
#     def warp_pointer(self, x, y, src_window = X.NONE, src_x = 0, src_y = 0,
#                      src_width = 0, src_height = 0, onerror = None):
#     def set_input_focus(self, focus, revert_to, time, onerror = None):
#     def get_input_focus(self):
#     def query_keymap(self):
#     def open_font(self, name):
#     def list_fonts(self, pattern, max_names):
#     def list_fonts_with_info(self, pattern, max_names):
#     def set_font_path(self, path, onerror = None):
#     def get_font_path(self):
#     def query_extension(self, name):
#     def list_extensions(self):
#     def change_keyboard_mapping(self, first_keycode, keysyms, onerror = None):
#     def get_keyboard_mapping(self, first_keycode, count):
#     def change_keyboard_control(self, onerror = None, **keys):
#     def get_keyboard_control(self):
#     def bell(self, percent = 0, onerror = None):
#     def change_pointer_control(self, accel = None, threshold = None, onerror = None):
#     def get_pointer_control(self):
#     def set_screen_saver(self, timeout, interval, prefer_blank, allow_exposures, onerror = None):
#     def get_screen_saver(self):
#     def change_hosts(self, mode, host_family, host, onerror = None):
#     def list_hosts(self):
#     def set_access_control(self, mode, onerror = None):
#     def set_close_down_mode(self, mode, onerror = None):
#     def force_screen_saver(self, mode, onerror = None):
#     def set_pointer_mapping(self, map):
#     def get_pointer_mapping(self):
#     def set_modifier_mapping(self, keycodes):
#     def get_modifier_mapping(self):
#     def no_operation(self, onerror = None):
# 
# Path: Xlib/ext/dpms.py
# class DPMSGetVersion(rq.ReplyRequest):
# class DPMSCapable(rq.ReplyRequest):
# class DPMSGetTimeouts(rq.ReplyRequest):
# class DPMSSetTimeouts(rq.Request):
# class DPMSEnable(rq.Request):
# class DPMSDisable(rq.Request):
# class DPMSForceLevel(rq.Request):
# class DPMSInfo(rq.ReplyRequest):
# def get_version(self):
# def capable(self):
# def get_timeouts(self):
# def set_timeouts(self, standby_timeout, suspend_timeout, off_timeout):
# def enable(self):
# def disable(self):
# def force_level(self, power_level):
# def info(self):
# def init(disp, _info):


import random
import time
from Xlib import display
from Xlib.ext import dpms
            self.d.dpms_enable()

        self.d.sync()

    def restore(self):
        print('Restoring DPMS configuration')
        self.d.dpms_set_timeouts(self.initial_timeouts.standby_timeout,
                                 self.initial_timeouts.suspend_timeout,
                                 self.initial_timeouts.off_timeout)
        if self.initial_info.state:
            self.d.dpms_enable()
        else:
            self.d.dpms_disable()

        self.d.sync()

        self.print_dpms()

    def set_random_timeouts(self):
        # Can be any number greater than 0
        # Using 10 just to not turnoff the screen suddenly
        standby_timeout = random.randint(10, 600)
        # Shouldn't be smaller than standby_timeout
        suspend_timeout = random.randint(standby_timeout, 600)
        # Shouldn't be smaller than standby_timeout or suspend_timeout
        off_timeout = random.randint(suspend_timeout, 600)
        self.d.dpms_set_timeouts(standby_timeout, suspend_timeout, off_timeout)
        self.d.sync()

    def turn_off_display(self):

# Path: Xlib/display.py
# class _BaseDisplay(protocol_display.Display):
# class Display(object):
#     def __init__(self, *args, **keys):
#     def get_atom(self, atomname, only_if_exists=0):
#     def __init__(self, display = None):
#     def get_display_name(self):
#     def fileno(self):
#     def close(self):
#     def set_error_handler(self, handler):
#     def flush(self):
#     def sync(self):
#     def next_event(self):
#     def pending_events(self):
#     def has_extension(self, extension):
#     def create_resource_object(self, type, id):
#     def __getattr__(self, attr):
#     def screen(self, sno = None):
#     def screen_count(self):
#     def get_default_screen(self):
#     def extension_add_method(self, object, name, function):
#     def extension_add_event(self, code, evt, name = None):
#     def extension_add_subevent(self, code, subcode, evt, name = None):
#     def add_extension_error(self, code, err):
#     def keycode_to_keysym(self, keycode, index):
#     def keysym_to_keycode(self, keysym):
#     def keysym_to_keycodes(self, keysym):
#     def refresh_keyboard_mapping(self, evt):
#     def _update_keymap(self, first_keycode, count):
#     def lookup_string(self, keysym):
#     def rebind_string(self, keysym, newstring):
#     def intern_atom(self, name, only_if_exists = 0):
#     def get_atom(self, atom, only_if_exists = 0):
#     def get_atom_name(self, atom):
#     def get_selection_owner(self, selection):
#     def send_event(self, destination, event, event_mask = 0, propagate = 0,
#                    onerror = None):
#     def ungrab_pointer(self, time, onerror = None):
#     def change_active_pointer_grab(self, event_mask, cursor, time, onerror = None):
#     def ungrab_keyboard(self, time, onerror = None):
#     def allow_events(self, mode, time, onerror = None):
#     def grab_server(self, onerror = None):
#     def ungrab_server(self, onerror = None):
#     def warp_pointer(self, x, y, src_window = X.NONE, src_x = 0, src_y = 0,
#                      src_width = 0, src_height = 0, onerror = None):
#     def set_input_focus(self, focus, revert_to, time, onerror = None):
#     def get_input_focus(self):
#     def query_keymap(self):
#     def open_font(self, name):
#     def list_fonts(self, pattern, max_names):
#     def list_fonts_with_info(self, pattern, max_names):
#     def set_font_path(self, path, onerror = None):
#     def get_font_path(self):
#     def query_extension(self, name):
#     def list_extensions(self):
#     def change_keyboard_mapping(self, first_keycode, keysyms, onerror = None):
#     def get_keyboard_mapping(self, first_keycode, count):
#     def change_keyboard_control(self, onerror = None, **keys):
#     def get_keyboard_control(self):
#     def bell(self, percent = 0, onerror = None):
#     def change_pointer_control(self, accel = None, threshold = None, onerror = None):
#     def get_pointer_control(self):
#     def set_screen_saver(self, timeout, interval, prefer_blank, allow_exposures, onerror = None):
#     def get_screen_saver(self):
#     def change_hosts(self, mode, host_family, host, onerror = None):
#     def list_hosts(self):
#     def set_access_control(self, mode, onerror = None):
#     def set_close_down_mode(self, mode, onerror = None):
#     def force_screen_saver(self, mode, onerror = None):
#     def set_pointer_mapping(self, map):
#     def get_pointer_mapping(self):
#     def set_modifier_mapping(self, keycodes):
#     def get_modifier_mapping(self):
#     def no_operation(self, onerror = None):
# 
# Path: Xlib/ext/dpms.py
# class DPMSGetVersion(rq.ReplyRequest):
# class DPMSCapable(rq.ReplyRequest):
# class DPMSGetTimeouts(rq.ReplyRequest):
# class DPMSSetTimeouts(rq.Request):
# class DPMSEnable(rq.Request):
# class DPMSDisable(rq.Request):
# class DPMSForceLevel(rq.Request):
# class DPMSInfo(rq.ReplyRequest):
# def get_version(self):
# def capable(self):
# def get_timeouts(self):
# def set_timeouts(self, standby_timeout, suspend_timeout, off_timeout):
# def enable(self):
# def disable(self):
# def force_level(self, power_level):
# def info(self):
# def init(disp, _info):


# Path: examples/dpms.py
import random
import time
from Xlib import display
from Xlib.ext import dpms

            self.d.dpms_enable()

        self.d.sync()

    def restore(self):
        print('Restoring DPMS configuration')
        self.d.dpms_set_timeouts(self.initial_timeouts.standby_timeout,
                                 self.initial_timeouts.suspend_timeout,
                                 self.initial_timeouts.off_timeout)
        if self.initial_info.state:
            self.d.dpms_enable()
        else:
            self.d.dpms_disable()

        self.d.sync()

        self.print_dpms()

    def set_random_timeouts(self):
        # Can be any number greater than 0
        # Using 10 just to not turnoff the screen suddenly
        standby_timeout = random.randint(10, 600)
        # Shouldn't be smaller than standby_timeout
        suspend_timeout = random.randint(standby_timeout, 600)
        # Shouldn't be smaller than standby_timeout or suspend_timeout
        off_timeout = random.randint(suspend_timeout, 600)
        self.d.dpms_set_timeouts(standby_timeout, suspend_timeout, off_timeout)
        self.d.sync()

    def turn_off_display(self):

        self.d.dpms_force_level(dpms.DPMSModeOff)