Mini Shell

Direktori : /lib64/python3.6/site-packages/pyanaconda/__pycache__/
Upload File :
Current File : //lib64/python3.6/site-packages/pyanaconda/__pycache__/timezone.cpython-36.pyc

3

Z��e�@sdZddlZddlZddlmZddlmZddlmZddl	m
Z
ddlmZddl
mZmZdd	lmZdd
lmZddlmZddlmZee�Zd
ddddddddddddddddddd d!d"d#d$d%d&d'd(gZd)Zd*Zd+d,�Zd9d-d.�Zd/d0�Zd1d2�Z d3d4�Z!d5d6�Z"d7d8�Z#dS):z�
Module providing functions for getting the list of timezones, writing timezone
configuration, valid timezones recognition etc.

�N)�OrderedDict)�util)�THREAD_STORAGE)�flags)�
BOOTLOADER)�TIMEZONE�STORAGE)�is_module_available)�	threadMgr)�arch)�get_module_loggerzGMT+1zGMT+2zGMT+3zGMT+4zGMT+5zGMT+6zGMT+7zGMT+8zGMT+9zGMT+10zGMT+11zGMT+12zGMT-1zGMT-2zGMT-3zGMT-4zGMT-5zGMT-6zGMT-7zGMT-8zGMT-9zGMT-10zGMT-11zGMT-12zGMT-13zGMT-14ZUTCZGMTZchronyZchronydcCsztj�rdS|jrDtjrDtjt�tj	t
�}|j�}|j|�d}dg}|jr`|j
d�n
|j
d�tj||�dS)z�
    Try to guess if RTC uses UTC time or not, set timezone.isUtc properly and
    set system time from RTC using the UTC guess.
    Guess is done by searching for bootable ntfs devices.

    :param timezone_proxy: DBus proxy of the timezone module
    N�hwclockz	--hctosysz--utcz--localtime)r�is_s390�IsUTCrZautomatedInstallr
�waitrr�	get_proxyrZ
DetectWindowsZSetIsUTC�appendr�execWithRedirect)�timezone_proxyZbootloader_proxyZis_utc�cmd�args�r� /usr/lib64/python3.6/timezone.py�time_initialize6s




rcCsZtj�rdStt�sdS|s$tj�}d}dg}|jr@|jd�n
|jd�tj||�dS)zf
    Save system time to HW clock.

    :param timezone_proxy: DBus proxy of the timezone module

    Nr
z	--systohcz--utcz--local)	rrr	rrrrrr)rrrrrr�
save_hw_clockSs
rcCstj|d�}|sdS|dS)aj
    Get the preferred timezone for a given territory. Note that this function
    simply returns the first timezone in the list of timezones for a given
    territory.

    :param territory: territory to get preferred timezone for
    :type territory: str
    :return: preferred timezone for the given territory or None if no found
    :rtype: str or None

    )ZterritoryIdNr)�	langtableZlist_timezones)Z	territoryZ	timezonesrrr�get_preferred_timezonems
rcCsnt�}xVtjD]L}|jdd�}t|�dkr|d|krDt�||d<||dj|d�qWtt�|d<|S)za
    Get a dictionary mapping the regions to the list of their timezones.

    :rtype: dict

    �/�rZEtc)r�pytz�common_timezones�split�len�set�add�	ETC_ZONES)�resultZtz�partsrrr�get_all_regions_and_timezones�sr(cCsdd�tD�}|tj|kS)zx
    Check if a given string is a timezone specification offered by GUI.

    :type timezone: str
    :rtype: bool

    cSsg|]}d|�qS)zEtc/r)�.0Zzonerrr�
<listcomp>�sz(is_valid_ui_timezone.<locals>.<listcomp>)r%rr )�timezoneZ	etc_zonesrrr�is_valid_ui_timezone�s	r,cCst|�p|tjkS)a�
    Check if a given string is a valid timezone specification.

    This includes also deprecated/backward timezones linked to other timezones
    in tz database (eg Japan -> Asia/Tokyo). Both the tzdata package (installed
    system) and TimezoneMap widget (installer GUI) should support them and be
    able link them to the correct timezone specification using the data from
    "backward" file.

    :type timezone: str
    :rtype: bool
    )r,rZ
all_timezones)r+rrr�is_valid_timezone�sr-cCs
tj|�S)z�
    Return a tzinfo object for a given timezone name.

    :param str timezone: the timezone name
    :rtype: datetime.tzinfo
    )rr+)r+rrr�get_timezone�sr.)N)$�__doc__rr�collectionsrZpyanaconda.corerZpyanaconda.core.constantsrZpyanaconda.flagsrZ+pyanaconda.modules.common.constants.objectsrZ,pyanaconda.modules.common.constants.servicesrrZpyanaconda.modules.common.utilr	Zpyanaconda.threadingr
ZblivetrZpyanaconda.anaconda_loggersr�__name__�logr%ZNTP_PACKAGEZNTP_SERVICErrrr(r,r-r.rrrr�<module>s6