%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/mac_power.pyc

�
���^c@@s(dZddlmZmZmZddlZddlZddlm	Z	ddl
mZddlm
Z
dZd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"dS(uI
Module for editing power settings on macOS

 .. versionadded:: 2016.3.0
i(tabsolute_importtunicode_literalstprint_functionN(tSaltInvocationError(tsix(trangeupowercC@s tjjj�stdfStS(u
    Only for macOS
    uMThe mac_power module could not be loaded: module only works on macOS systems.(tsalttutilstplatformt	is_darwintFalset__virtualname__(((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pyt__virtual__s
cC@s�t|tj�rF|j�dkr(dSdj|�}t|��n�t|t�r�|rydj|�}t|��q�dSnat|t�r�|tdd�kr�|Sdj|�}t|��nd	j|�}t|��d
S(uA
    Helper function that validates the minutes parameter. Can be any number
    between 1 and 180. Can also be the string values "Never" and "Off".

    Because "On" and "Off" get converted to boolean values on the command line
    it will error if "On" is passed

    Returns: The value to be passed to the command
    uneveruoffuNeveruUInvalid String Value for Minutes.
String values must be "Never" or "Off".
Passed: {0}u�Invalid Boolean Value for Minutes.
Boolean value "On" or "True" is not allowed.
Salt CLI converts "On" to boolean True.
Passed: {0}ii�uXInvalid Integer Value for Minutes.
Integer values must be between 1 and 180.
Passed: {0}u5Unknown Variable Type Passed for Minutes.
Passed: {0}N(uneveruoff(	t
isinstanceRtstring_typestlowertformatRtbooltintR(tminutestmsg((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pyt_validate_sleep!s*				cC@s"it�d6t�d6t�d6S(uI
    Displays the amount of idle time until the machine sleeps. Settings for
    Computer, Display, and Hard Disk are displayed.

    :return: A dictionary containing the sleep status for Computer, Display, and
        Hard Disk

    :rtype: dict

    CLI Example:

    .. code-block:: bash

        salt '*' power.get_sleep
    uComputeruDisplayu	Hard Disk(tget_computer_sleeptget_display_sleeptget_harddisk_sleep(((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pyt	get_sleepKs

cC@swt|�}dj|�}tjjj|�g}x6tttfD]%}|j	tjjj
||��qDWt|�S(u�
    Sets the amount of idle time until the machine sleeps. Sets the same value
    for Computer, Display, and Hard Disk. Pass "Never" or "Off" for computers
    that should never sleep.

    :param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
    :ptype: int, str

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' power.set_sleep 120
        salt '*' power.set_sleep never
    usystemsetup -setsleep {0}(RRRRt	mac_utilstexecute_return_successRRRtappendtconfirm_updatedtall(Rtvaluetcmdtstatetcheck((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pyt	set_sleep`scC@s(tjjjd�}tjjj|�S(u�
    Display the amount of idle time until the computer sleeps.

    :return: A string representing the sleep settings for the computer
    :rtype: str

    CLI Example:

    ..code-block:: bash

        salt '*' power.get_computer_sleep
    usystemsetup -getcomputersleep(RRRtexecute_return_resulttparse_return(tret((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pyR�s
	cC@sJt|�}dj|�}tjjj|�tjjjt|�t�S(u�
    Set the amount of idle time until the computer sleeps. Pass "Never" of "Off"
    to never sleep.

    :param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
    :ptype: int, str

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' power.set_computer_sleep 120
        salt '*' power.set_computer_sleep off
    u!systemsetup -setcomputersleep {0}(	RRRRRRRtstrR(RRR ((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytset_computer_sleep�s	cC@s(tjjjd�}tjjj|�S(u�
    Display the amount of idle time until the display sleeps.

    :return: A string representing the sleep settings for the displey
    :rtype: str

    CLI Example:

    ..code-block:: bash

        salt '*' power.get_display_sleep
    usystemsetup -getdisplaysleep(RRRR$R%(R&((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pyR�s
	cC@sJt|�}dj|�}tjjj|�tjjjt|�t�S(u�
    Set the amount of idle time until the display sleeps. Pass "Never" of "Off"
    to never sleep.

    :param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
    :ptype: int, str

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' power.set_display_sleep 120
        salt '*' power.set_display_sleep off
    u systemsetup -setdisplaysleep {0}(	RRRRRRRR'R(RRR ((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytset_display_sleep�s	cC@s(tjjjd�}tjjj|�S(u�
    Display the amount of idle time until the hard disk sleeps.

    :return: A string representing the sleep settings for the hard disk
    :rtype: str

    CLI Example:

    ..code-block:: bash

        salt '*' power.get_harddisk_sleep
    usystemsetup -getharddisksleep(RRRR$R%(R&((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pyR�s
	cC@sJt|�}dj|�}tjjj|�tjjjt|�t�S(u�
    Set the amount of idle time until the harddisk sleeps. Pass "Never" of "Off"
    to never sleep.

    :param minutes: Can be an integer between 1 and 180 or "Never" or "Off"
    :ptype: int, str

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' power.set_harddisk_sleep 120
        salt '*' power.set_harddisk_sleep off
    u!systemsetup -setharddisksleep {0}(	RRRRRRRR'R(RRR ((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytset_harddisk_sleep�s	cC@s=tjjjd�}tjjjtjjj|��dkS(u�
    Displays whether 'wake on modem' is on or off if supported

    :return: A string value representing the "wake on modem" settings
    :rtype: str

    CLI Example:

    .. code-block:: bash

        salt '*' power.get_wake_on_modem
    usystemsetup -getwakeonmodemuon(RRRR$tvalidate_enabledR%(R&((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytget_wake_on_modem
s
	cC@sMtjjj|�}dj|�}tjjj|�tjjj|t�S(u�
    Set whether or not the computer will wake from sleep when modem activity is
    detected.

    :param bool enabled: True to enable, False to disable. "On" and "Off" are
        also acceptable values. Additionally you can pass 1 and 0 to represent
        True and False respectively

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' power.set_wake_on_modem True
    usystemsetup -setwakeonmodem {0}(RRRR+RRRR,(tenabledR!R ((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytset_wake_on_modemscC@s=tjjjd�}tjjjtjjj|��dkS(u�
    Displays whether 'wake on network' is on or off if supported

    :return: A string value representing the "wake on network" settings
    :rtype: string

    CLI Example:

    .. code-block:: bash

        salt '*' power.get_wake_on_network
    u#systemsetup -getwakeonnetworkaccessuon(RRRR$R+R%(R&((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytget_wake_on_network9s
	cC@sMtjjj|�}dj|�}tjjj|�tjjj|t�S(u�
    Set whether or not the computer will wake from sleep when network activity
    is detected.

    :param bool enabled: True to enable, False to disable. "On" and "Off" are
        also acceptable values. Additionally you can pass 1 and 0 to represent
        True and False respectively

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' power.set_wake_on_network True
    u'systemsetup -setwakeonnetworkaccess {0}(RRRR+RRRR/(R-R!R ((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytset_wake_on_networkLscC@s=tjjjd�}tjjjtjjj|��dkS(u
    Displays whether 'restart on power failure' is on or off if supported

    :return: A string value representing the "restart on power failure" settings
    :rtype: string

    CLI Example:

    .. code-block:: bash

        salt '*' power.get_restart_power_failure
    u#systemsetup -getrestartpowerfailureuon(RRRR$R+R%(R&((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytget_restart_power_failurehs
	cC@sMtjjj|�}dj|�}tjjj|�tjjj|t�S(u�
    Set whether or not the computer will automatically restart after a power
    failure.

    :param bool enabled: True to enable, False to disable. "On" and "Off" are
        also acceptable values. Additionally you can pass 1 and 0 to represent
        True and False respectively

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' power.set_restart_power_failure True
    u'systemsetup -setrestartpowerfailure {0}(RRRR+RRRR1(R-R!R ((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytset_restart_power_failure{scC@s=tjjjd�}tjjjtjjj|��dkS(u�
    Displays whether 'restart on freeze' is on or off if supported

    :return: A string value representing the "restart on freeze" settings
    :rtype: string

    CLI Example:

    .. code-block:: bash

        salt '*' power.get_restart_freeze
    usystemsetup -getrestartfreezeuon(RRRR$R+R%(R&((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytget_restart_freeze�s
	cC@sPtjjj|�}dj|�}tjjj|�tjjj|tt�S(u�
    Specifies whether the server restarts automatically after a system freeze.
    This setting doesn't seem to be editable. The command completes successfully
    but the setting isn't actually updated. This is probably a macOS. The
    functions remains in case they ever fix the bug.

    :param bool enabled: True to enable, False to disable. "On" and "Off" are
        also acceptable values. Additionally you can pass 1 and 0 to represent
        True and False respectively

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' power.set_restart_freeze True
    u!systemsetup -setrestartfreeze {0}(	RRRR+RRRR3tTrue(R-R!R ((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytset_restart_freeze�scC@s=tjjjd�}tjjjtjjj|��dkS(u7
    Displays whether 'allow power button to sleep computer' is on or off if
    supported

    :return: A string value representing the "allow power button to sleep
        computer" settings

    :rtype: string

    CLI Example:

    .. code-block:: bash

        salt '*' power.get_sleep_on_power_button
    u/systemsetup -getallowpowerbuttontosleepcomputeruon(RRRR$R+R%(R&((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytget_sleep_on_power_button�s	cC@sMtjjj|�}dj|�}tjjj|�tjjj|t�S(u�
    Set whether or not the power button can sleep the computer.

    :param bool enabled: True to enable, False to disable. "On" and "Off" are
        also acceptable values. Additionally you can pass 1 and 0 to represent
        True and False respectively

    :return: True if successful, False if not
    :rtype: bool

    CLI Example:

    .. code-block:: bash

        salt '*' power.set_sleep_on_power_button True
    u3systemsetup -setallowpowerbuttontosleepcomputer {0}(RRRR+RRRR6(R-R!R ((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pytset_sleep_on_power_button�s(#t__doc__t
__future__RRRtsalt.utils.mac_utilsRtsalt.utils.platformtsalt.exceptionsRtsalt.extRtsalt.ext.six.movesRRRRRR#RR(RR)RR*R,R.R/R0R1R2R3R5R6R7(((s:/usr/lib/python2.7/site-packages/salt/modules/mac_power.pyt<module>s6		*		 															

Zerion Mini Shell 1.0