Anons79 Mini Shell

Directory : /usr/lib/python2.7/site-packages/dnf/
Upload File :
Current File : //usr/lib/python2.7/site-packages/dnf/util.pyc

�
�[/\c@@s�ddlmZddlmZddlmZddlmZmZddlmZm	Z	ddl
mZddlZddl
ZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZejd	�Zd
�Zdd�Z!dd�Z"ddd
d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*d�Z+d�Z,d�Z-d�Z.d�Z/d�Z0d�Z1d�Z2d�Z3d�Z4d �Z5d!�Z6d"�Z7d#�Z8d$�Z9d%�Z:d&�Z;d'�Z<e=d(�Z>d)d*ej?d+�Z@d,�ZAd-�ZBd.eCfd/��YZDd0eEfd1��YZFd2eGfd3��YZHdS(4i(tprint_function(tabsolute_import(tunicode_literalsi(tPY3t
basestring(t_tucd(treduceNudnfcC@s�t|dg�t|dg�t|dg�x�|D]�}tjjj|�d}|jd�rx|jj|�q7|r�|d
kr�|jj|�q7|jd
�r�|jj|d�q7|j	j|�q7WdS(u�
    Categorize :param values list into packages, groups and filenames

    :param namespace: argparse.Namespace, where specs will be stored
    :param values: list of specs, whether packages ('foo') or groups/modules ('@bar')
                   or filenames ('*.rmp', 'http://*', ...)

    To access packages use: specs.pkg_specs,
    to access groups use: specs.grp_specs,
    to access filenames use: specs.filenames
    u	filenamesu	grp_specsu	pkg_specsiu.rpmuhttpuftpufileuhttpsu@iN(uhttpuftpufileuhttps(
tsetattrtdnftpycompturlparsetendswitht	filenamestappendt
startswitht	grp_specst	pkg_specs(t	namespacetvaluestvaluetschemes((s,/usr/lib/python2.7/site-packages/dnf/util.pyt_parse_specs2s

cC@s�tj�}tjj|_|r�t|j�tkr?|jnt|j	|j�|_
|j|_tjj
|j|jt�|_|j|_|_n|S(N(tlibrepotHandleR	tconstt
USER_AGENTt	useragentttypetthrottletintt	bandwidthtmaxspeedtproxytrepot_user_pass_strtproxy_usernametproxy_passwordtTruetproxyuserpwdt	sslverifyt
sslverifypeert
sslverifyhost(tconfthandle((s,/usr/lib/python2.7/site-packages/dnf/util.pyt_non_repo_handleNscC@s�|dkrtjj�}ntjj|||�}tjj|j	�rR|j	St
|jg�}|jd|�|j
�g}y&tjjjtjj|�t�WnDtk
r�}|jr�tt|���ntjt|��nX|j	S(Ni(tNoneR	tcallbacktNullDownloadProgressR"tRemoteRPMPayloadtostpathtexistst
local_pathtsumt
download_sizetstartt_librepo_targettlibdnft
PackageTargettdownloadPackagestVectorPPackageTargetR&tRuntimeErrortstricttIOErrortstrtloggerterror(turlR+tprogresstploadtest_remote_sizettargetste((s,/usr/lib/python2.7/site-packages/dnf/util.pyt_urlopen_progress\s&	uw+bcK@s�tr%d|kr%|jdd�ntj||�}yT|r\|jj||j��n.tjj	j
|rw|jnd||j��Wn%t
k
r�}tt|���nX|jd�|S(u|
    Open the specified absolute url, return a file object
    which respects proxy setting even for non-repo downloads
    ubuencodinguutf-8iN(Rt
setdefaultttempfiletNamedTemporaryFilet_repotdownloadUrltfilenoR:R"t
DownloadertdownloadURLt_configR.R>R@RAtseek(RDR+R"tmodetkwargstfoRI((s,/usr/lib/python2.7/site-packages/dnf/util.pyt_urlopenss2
cC@s'|j|�r#|t|� }n|S(N(Rtlen(tstr((s,/usr/lib/python2.7/site-packages/dnf/util.pytrtrim�scC@stj�dkS(Ni(R2tgeteuid(((s,/usr/lib/python2.7/site-packages/dnf/util.pyt	am_i_root�scC@s=x6tj|�D]%}tjj||�}t|�qWdS(uBRemove all files and dirs under `path`

    Also see rm_rf()

    N(R2tlistdirR3tjointrm_rf(R3tentrytcontained_path((s,/usr/lib/python2.7/site-packages/dnf/util.pyt	clear_dir�scC@s_ytj|dd�WnAtk
rZ}|jtjksNtjj|�r[|�q[nXdS(NRUi�(R2tmakedirstOSErrorterrnotEEXISTR3tisdir(tdnameRI((s,/usr/lib/python2.7/site-packages/dnf/util.pyt
ensure_dir�s
%cC@s@yt|�}Wn#tk
r5tt|��}nX|dkS(Ni(RYt	TypeErrortlist(titerabletl((s,/usr/lib/python2.7/site-packages/dnf/util.pytempty�s

cC@s3t|�}yt|�SWntk
r.dSXdS(uFReturns the first item from an iterable or None if it has no elements.N(titertnextt
StopIterationR.(Rntit((s,/usr/lib/python2.7/site-packages/dnf/util.pytfirst�s

cC@s=t|�}ytd�|D��SWntk
r8dSXdS(Ncs@s!|]}|dk	r|VqdS(N(R.(t.0titem((s,/usr/lib/python2.7/site-packages/dnf/util.pys	<genexpr>�s(RqRrRsR.(RnRt((s,/usr/lib/python2.7/site-packages/dnf/util.pytfirst_not_none�s

cC@stj�t|�S(N(ttimetfile_timestamp(tfn((s,/usr/lib/python2.7/site-packages/dnf/util.pytfile_age�scC@stj|�jS(N(R2tstattst_mtime(R{((s,/usr/lib/python2.7/site-packages/dnf/util.pyRz�scC@s>ytjtj��dSWntk
r9dtj�SXdS(NiuUID: %s(tpwdtgetpwuidR2R]tKeyError(((s,/usr/lib/python2.7/site-packages/dnf/util.pytget_effective_login�s
cC@s4x-|D]%}|j|�}|dkr|SqW|S(u!Like dict.get() for nested dicts.N(tgetR.(tdcttkeyst	not_foundtk((s,/usr/lib/python2.7/site-packages/dnf/util.pytget_in�s

c@s%�fd�}t||ggf�S(Nc@s"|t�|��j|�|S(N(tboolR(taccRw(R{(s,/usr/lib/python2.7/site-packages/dnf/util.pytsplitter�s(R(R{RnR�((R{s,/usr/lib/python2.7/site-packages/dnf/util.pytgroup_by_filter�scc@s.x'|D]}||�r!|Vn|VqWdS(u/Insert an item into an iterable by a condition.N((RwRnt	conditiont
original_item((s,/usr/lib/python2.7/site-packages/dnf/util.pyt	insert_if�s
cC@s+yt|�Wntk
r"tSXtSdS(u&Test whether an iterator is exhausted.N(RrRsR&tFalse(titerator((s,/usr/lib/python2.7/site-packages/dnf/util.pytis_exhausted�s

cC@s;t|�r|g}nt|t�o:td�|D��S(Ncs@s%|]}t|�td�@VqdS(u*[?N(tset(Rvtp((s,/usr/lib/python2.7/site-packages/dnf/util.pys	<genexpr>�s(tis_string_typet
isinstanceRmtany(tpattern((s,/usr/lib/python2.7/site-packages/dnf/util.pytis_glob_pattern�scC@s$trt|t�St|t�SdS(N(RR�RAR(tobj((s,/usr/lib/python2.7/site-packages/dnf/util.pyR��s
c@s�fd�}|S(u�Decorator to get lazy attribute initialization.

    Composes with @property. Force reinitialization by deleting the <attrname>.
    c@s��fd�}|S(Nc@sFyt|��SWn.tk
rA�|�}t|�|�|SXdS(N(tgetattrtAttributeErrorR(R�tval(tattrnameR{(s,/usr/lib/python2.7/site-packages/dnf/util.pyt
cached_getter�s
((R{R�(R�(R{s,/usr/lib/python2.7/site-packages/dnf/util.pyt
get_decorated�s((R�R�((R�s,/usr/lib/python2.7/site-packages/dnf/util.pytlazyattr�s	cG@stt||��S(u�Like functools.map(), but return a list instead of an iterator.

    This means all side effects of fn take place even without iterating the
    result.

    (Rmtmap(R{tseq((s,/usr/lib/python2.7/site-packages/dnf/util.pytmapallscC@sVtjdtj|��}tjjsRtj�d}|rR|j|�}qRn|S(u6Convert time into locale aware datetime string object.u%ci(	Rytstrftimet	localtimeR	R
Rtlocalet	getlocaletdecode(t	timestamptttcurrent_locale_setting((s,/usr/lib/python2.7/site-packages/dnf/util.pytnormalize_time
scC@s1ytjd�}|SWntk
r,dSXdS(u�Decide whether we are on line power.

    Returns True if we are on line power, False if not, None if it can not be
    decided.

    u/usr/bin/on_ac_powerN(t
subprocesstcallRfR.(tret((s,/usr/lib/python2.7/site-packages/dnf/util.pyton_ac_powers
	
cC@s�yddl}Wntk
r$dSXyF|j�}|jdd�}|j|d�}|jdd�}Wn|jk
r�dSX|dkr�dS|dkr�tS|d
kr�t	St
d|��dS(u�Decide whether we are on metered connection.

    Returns:
      True: if on metered connection
      False: if not
      None: if it can not be decided
    iNuorg.freedesktop.NetworkManageru/org/freedesktop/NetworkManageruorg.freedesktop.DBus.PropertiesuMeterediiiiu&Unknown value for metered property: %r(ii(ii(tdbustImportErrorR.t	SystemBust
get_objectt	InterfacetGett
DBusExceptionR&R�t
ValueError(R�tbusR!tifacetmetered((s,/usr/lib/python2.7/site-packages/dnf/util.pyton_metered_connection!s&
		cC@s7tj|�\}}tjj||�t||�fS(u�Use a predicate to partition entries into false entries and true entries.

    Credit: Python library itertools' documentation.

    (t	itertoolstteeR	R
tfilterfalsetfilter(tpredRntt1tt2((s,/usr/lib/python2.7/site-packages/dnf/util.pyt	partition>scC@s)ytj|�Wntk
r$nXdS(N(tshutiltrmtreeRf(R3((s,/usr/lib/python2.7/site-packages/dnf/util.pyRaGs
c#@sat���fd�}t�||�}||�Vx%tr\||�}|sTPn|Vq8WdS(u�Split an iterable into tuples by a condition.

    Inserts a separator before each item which meets the condition and then
    cuts the iterable by these separators.

    c@sttj�fd�|��S(Nc@s
|�kS(N((RI(t	separator(s,/usr/lib/python2.7/site-packages/dnf/util.pyt<lambda>Ws(ttupleR�t	takewhile(Rt(R�(s,/usr/lib/python2.7/site-packages/dnf/util.pytnext_subsequenceVsN(tobjectR�R&(RnR�R�tmarkedtsubsequence((R�s,/usr/lib/python2.7/site-packages/dnf/util.pytsplit_byMs		cC@s!|j|�r|t|�SdS(N(RRYR.(RZtprefix((s,/usr/lib/python2.7/site-packages/dnf/util.pytstrip_prefixescC@sE|stj|tj�r+tj|d�St|d��WdQXdS(u{Create an empty file if it doesn't exist or bump it's timestamps.

    If no_create is True only bumps the timestamps.
    uaN(R2taccesstF_OKtutimeR.topen(R3t	no_create((s,/usr/lib/python2.7/site-packages/dnf/util.pyttouchksuwriteucC@s�y�|dkr|j|�nn|dkr8|j�nU|dkr^|j|�|j�n/|dkr}t|d|�ntd|��Wn;tk
r�}tjdjt|�j	t
|���nXdS(Nuwriteuflushuwrite_flushuprinttfileuUnsupported type: u{}: {}(twritetflushtprintR�R@RBtcriticaltformatRt__name__R(ttptmsgtoutRI((s,/usr/lib/python2.7/site-packages/dnf/util.pyt_terminal_messengervs


(cC@s�d}t|�dk}xpt|dd�D]\\}}|r\|dtd�d|7}n|dtd�d7}|dj|�7}q+W|S(	u�
    Format string about problems in resolve

    :param resolve_problems: list with list of strings (output of goal.problem_rules())
    :return: string
    uiR8u
 uProblemu %d: u: u
  - (RYt	enumerateRR`(tresolve_problemsR�tcount_problemstitrs((s,/usr/lib/python2.7/site-packages/dnf/util.pyt_format_resolve_problems�scC@su|j�d}|j�dk	rK|j�dkrK||j�d7}n||j�d|j�d|j�S(Nu-u0u:u.(tNtER.tVtRtA(ttetnevra((s,/usr/lib/python2.7/site-packages/dnf/util.pyt	_te_nevra�s$ttmpdircB@s#eZd�Zd�Zd�ZRS(cC@s)dtjj}tjd|�|_dS(Nu%s-R�(R	RtPREFIXRLtmkdtempR3(tselfR�((s,/usr/lib/python2.7/site-packages/dnf/util.pyt__init__�scC@s|jS(N(R3(R�((s,/usr/lib/python2.7/site-packages/dnf/util.pyt	__enter__�scC@st|j�dS(N(RaR3(R�texc_typet	exc_valuet	traceback((s,/usr/lib/python2.7/site-packages/dnf/util.pyt__exit__�s(R�t
__module__R�R�R�(((s,/usr/lib/python2.7/site-packages/dnf/util.pyR��s		tBunchcB@s eZdZd�Zd�ZRS(u�Dictionary with attribute accessing syntax.

    In DNF, prefer using this over dnf.yum.misc.GenericHolder.

    Credit: Alex Martelli, Doug Hudgeon

    cO@s&tt|�j||�||_dS(N(tsuperR�R�t__dict__(R�targstkwds((s,/usr/lib/python2.7/site-packages/dnf/util.pyR��scC@s
t|�S(N(tid(R�((s,/usr/lib/python2.7/site-packages/dnf/util.pyt__hash__�s(R�R�t__doc__R�R(((s,/usr/lib/python2.7/site-packages/dnf/util.pyR��s	t
MultiCallListcB@s#eZd�Zd�Zd�ZRS(cC@s$tt|�j�|j|�dS(N(R�RR�textend(R�Rn((s,/usr/lib/python2.7/site-packages/dnf/util.pyR��sc@s��fd�}|S(Nc@s(���fd�}tt|���S(Nc@st|��}|���S(N(R�(tvtmethod(RRVtwhat(s,/usr/lib/python2.7/site-packages/dnf/util.pyt	call_what�s(RmR�(RRVR
(R�R	(RRVs,/usr/lib/python2.7/site-packages/dnf/util.pyR{�s((R�R	R{((R�R	s,/usr/lib/python2.7/site-packages/dnf/util.pyt__getattr__�sc@s%��fd�}tt||��S(Nc@st|���dS(N(R(Rw(R�R	(s,/usr/lib/python2.7/site-packages/dnf/util.pytsetter�s(RmR�(R�R	R�R((R�R	s,/usr/lib/python2.7/site-packages/dnf/util.pyt__setattr__�s(R�R�R�RR
(((s,/usr/lib/python2.7/site-packages/dnf/util.pyR�s		(It
__future__RRRR
RRtdnf.i18nRRt	functoolsRR	tdnf.callbackt	dnf.constt
dnf.pycompRgR�R�tloggingR2RR�R�tsysRLRytlibdnf.repoR:t	getLoggerRBRR.R-RJRXR\R^RdRkRpRuRxR|RzR�R�R�R�R�R�R�R�R�R�R�R�R�RaR�R�R�R�tstdoutR�R�R�R�R�tdictR�RmR(((s,/usr/lib/python2.7/site-packages/dnf/util.pyt<module>st				
																													

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]