-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/ui/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyc


($Oc@@sKdZddlmZddlZddlmZeededede	ded	e	d
ede	ded
e	Z
ee
d<e	e
d<edZde
fdYZde
fdYZdefdYZdefdYZdefdYZeZdZde
fdYZde
fdYZdS( sAbstraction for interacting with the user.

Applications can choose different types of UI, and they deal with displaying
messages or progress to the user, and with gathering different types of input.

Several levels are supported, and you can also register new factories such as
for a GUI.

bzrlib.ui.UIFactory
    Semi-abstract base class

bzrlib.ui.SilentUIFactory
    Produces no output and cannot take any input; useful for programs using
    bzrlib in batch mode or for programs such as loggerhead.

bzrlib.ui.CannedInputUIFactory
    For use in testing; the input values to be returned are provided 
    at construction.

bzrlib.ui.text.TextUIFactory
    Standard text command-line interface, with stdin, stdout, stderr.
    May make more or less advanced use of them, eg in drawing progress bars,
    depending on the detected capabilities of the terminal.
    GUIs may choose to subclass this so that unimplemented methods fall
    back to working through the terminal.
i(tabsolute_importN(tlazy_importsN
from bzrlib import (
    config,
    osutils,
    progress,
    trace,
    )
tyestnotytntontoffttruetfalset1t0cC@sb|dkrt}nd}t|ttfkr^y||j}Wq^tk
rZq^Xn|S(sReturns a boolean if the string can be interpreted as such.

    Interpret case insensitive strings as booleans. The default values
    includes: 'yes', 'no, 'y', 'n', 'true', 'false', '0', '1', 'on',
    'off'. Alternative values can be provided with the 'accepted_values'
    parameter.

    :param s: A string that should be interpreted as a boolean. It should be of
        type string or unicode.

    :param accepted_values: An optional dict with accepted strings as keys and
        True/False as values. The strings will be tested against a lowered
        version of 's'.

    :return: True or False for accepted strings, None otherwise.
    N(tNonet_valid_boolean_stringsttypetstrtunicodetlowertKeyError(tstaccepted_valuestval((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytbool_from_stringCs	
tConfirmationUserInterfacePolicycB@s2eZdZdZdZdZdZRS(sDWrapper for a UIFactory that allows or denies all confirmed actions.cC@s||_||_||_dS(sSGenerate a proxy UI that does no confirmations.

        :param wrapped_ui: Underlying UIFactory.
        :param default_answer: Bool for whether requests for
            confirmation from the user should be noninteractively accepted or
            denied.
        :param specific_answers: Map from confirmation_id to bool answer.
        N(t
wrapped_uitdefault_answertspecific_answers(tselfRRR((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyt__init__bs			cC@st|j|S(N(tgetattrR(Rtname((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyt__getattr__oscC@s#d|jj|j|j|jfS(Ns%s(%r, %r, %r)(t	__class__t__name__RRR(R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyt__repr__rs
	cC@sJ||jkr|j|S|jdk	r0|jS|jj|||SdS(N(RRRRtconfirm_action(Rtprompttconfirmation_idt
prompt_kwargs((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR#ys	(R!t
__module__t__doc__RRR"R#(((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR_s
	
		t	UIFactorycB@s:eZdZeddddddddd	d
ddd
dZdZdZdZdZdZ	ddZ
dZd*d*dZ
dZdZdZdZdZdZdZd*dZd Zd!Zd"Zd#Zd$Zed%Zd&Zd'Zd(Zd)Z RS(+s[UI abstraction.

    This tells the library how to display things to the user.  Through this
    layer different applications can choose the style of UI.

    UI Factories are also context managers, for some syntactic sugar some users
    need.

    :ivar suppressed_warnings: Identifiers for user warnings that should 
        no be emitted.
    tcross_format_fetchsDoing on-the-fly conversion from %(from_format)s to %(to_format)s.
This may take some time. Upgrade the repositories to the same format for better performance.texperimental_format_fetchsFetching into experimental format %(to_format)s.
This format may be unreliable or change in the future without an upgrade path.
tdeprecated_commandsThe command 'bzr %(deprecated_name)s' has been deprecated in bzr %(deprecated_in_version)s. Please use 'bzr %(recommended_name)s' instead.tdeprecated_command_optionsThe option '%(deprecated_name)s' to 'bzr %(command)s' has been deprecated in bzr %(deprecated_in_version)s. Please use '%(recommended_name)s' instead.trecommend_upgrades%(current_format_name)s is deprecated and a better format is available.
It is recommended that you upgrade by running the command
  bzr upgrade %(basedir)stlocks_steal_deadu3Stole dead lock %(lock_url)s %(other_holder_info)s.tnot_checking_ssl_certu*Not checking SSL certificate for %(host)s.cC@s"g|_t|_t|_dS(N(t_task_stacktsettsuppressed_warningstFalset_quiet(R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRs	cC@s|S(sContext manager entry support.

        Override in a concrete factory class if initialisation before use is
        needed.
        ((R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyt	__enter__scC@s|jtS(sContext manager exit support.

        Override in a concrete factory class if more cleanup than a simple
        self.clear_term() is needed when the UIFactory is finished with.
        (t
clear_termR4(Rtexc_typetexc_valtexc_tb((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyt__exit__s
cC@s
||_dS(sTell the UI to be more quiet, or not.

        Typically this suppresses progress bars; the application may also look
        at ui_factory.is_quiet().
        N(R5(Rtstate((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytbe_quietscC@s|j||S(sSeek user confirmation for an action.

        If the UI is noninteractive, or the user does not want to be asked
        about this action, True is returned, indicating bzr should just
        proceed.

        The confirmation id allows the user to configure certain actions to
        always be confirmed or always denied, and for UIs to specialize the
        display of particular confirmations.

        :param prompt: Suggested text to display to the user.
        :param prompt_kwargs: A dictionary of arguments that can be
            string-interpolated into the prompt.
        :param confirmation_id: Unique string identifier for the confirmation.
        (tget_boolean(RR$R%R&((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR#sucK@st|jdS(s,Prompt the user for a password.

        :param prompt: The prompt to present the user (must be unicode)
        :param kwargs: Arguments which will be expanded into the prompt.
                       This lets front ends display different things if
                       they so choose.

        :return: The password string, return None if the user canceled the
                 request. Note that we do not touch the encoding, users may
                 have whatever they see fit and the password should be
                 transported as is.
        N(tNotImplementedErrortget_password(RR$tkwargs((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR@s
cC@s|jS(N(R5(R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytis_quietscC@sp|dkr$tjjd}n|dkrEtjdt}n|dkrZd}n|j||}|S(sGet a stream for sending out bulk text data.

        This is used for commands that produce bulk text, such as log or diff
        output, as opposed to user interaction.  This should work even for
        non-interactive user interfaces.  Typically this goes to a decorated
        version of stdout, but in a GUI it might be appropriate to send it to a 
        window displaying the text.
     
        :param encoding: Unicode encoding for output; if not specified 
            uses the configured 'output_encoding' if any; otherwise the 
            terminal encoding. 
            (See get_terminal_encoding.)

        :param encoding_type: How to handle encoding errors:
            replace/strict/escape/exact.  Default is replace.
        toutput_encodingttracetreplaceN(RtconfigtGlobalStacktgettosutilstget_terminal_encodingtTruet_make_output_stream_explicit(Rtencodingt
encoding_typet
out_stream((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytmake_output_streams	cC@std|jjdS(Ns%%s doesn't support make_output_stream(R?R R!(RRMRN((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRL
scC@sK|jr%tj|jd|}ntjd|}|jj||S(sReturn a nested progress bar.

        When the bar has been finished with, it should be released by calling
        bar.finished().
        iN(R1tprogresstProgressTaskRtappend(Rtt((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytnested_progress_bars
	cC@sv|js tjd|fn||jkrB|jj|ntjd||jf|jsr|jndS(s+Called by the ProgressTask when it finishess!%r finished but nothing is actives%r is not in active stack %rN(R1twarningstwarntremovet_progress_all_finished(Rttask((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyt_progress_finisheds				cC@sdS(s0Called when the top-level progress task finishedN((R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRY(scC@sdS(siCalled by the ProgressTask when it changes.

        Should be specialized to draw the progress.
        N((RRZ((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyt_progress_updated,scC@sdS(sPrepare the terminal for output.

        This will, for example, clear text progress bars, and leave the
        cursor at the leftmost position.
        N((R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR73scC@sy|j|}Wn3tk
rFd||f}tjd||SXy||SWn4tk
r}d|||f}tj||SXdS(Nsbzr warning: %r, %rsno template for warning: s#bzr unprintable warning: %r, %r, %s(t_user_warning_templatesRRVRWt
ValueError(Rt
warning_idtmessage_argsttemplatetfailte((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytformat_user_warning;s

cC@st|jdS(sOPrompt the user for a list of alternatives.

        :param msg: message to be shown as part of the prompt.

        :param choices: list of choices, with the individual choices separated
            by '
', e.g.: choose("Save changes?", "&Yes
&No
&Cancel"). The
            letter after the '&' is the shortcut key for that choice. Thus you
            can type 'c' to select "Cancel".  Shorcuts are case insensitive.
            The shortcut does not need to be the first letter. If a shorcut key
            is not provided, the first letter for the choice will be used.

        :param default: default choice (index), returned for example when enter
            is pressed for the console version.

        :return: the index fo the user choice (so '0', '1' or '2' for
            respectively yes/no/cancel in the previous example).
        N(R?tchoose(Rtmsgtchoicestdefault((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyReJscC@s&|j|dddd}d|kS(sGet a boolean question answered from the user.

        :param prompt: a message to prompt the user with. Should be a single
            line without terminating \n.
        :return: True or False for y/yes or n/no.
        t?s&yes
&noRhiN(ReR(RR$tchoice((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR>^scC@st|jdS(sGet an integer from the user.

        :param prompt: a message to prompt the user with. Could be a multi-line
            prompt but without a terminating \n.

        :return: A signed integer.
        N(R?tget_integer(RR$((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRkhscC@stS(sConstruct a new ProgressView object for this UI.

        Application code should normally not call this but instead
        nested_progress_bar().
        (tNullProgressView(R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytmake_progress_viewrscC@s|jdd|d|dS(sRecommend the user upgrade a control directory.

        :param current_format_name: Description of the current format
        :param basedir: Location of the control dir
        R.tcurrent_format_nametbasedirN(tshow_user_warning(RRnRo((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR.zscC@sdS(sCalled by transports as they do IO.

        This may update a progress bar, spinner, or similar display.
        By default it does nothing.
        N((Rt	transportt
byte_countt	direction((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytreport_transport_activityscC@sdS(sBWrite out whatever transport activity has been measured.

        Implementations are allowed to do nothing, but it is useful if they can
        write a line to the log file.

        :param display: If False, only log to disk, if True also try to display
            a message to the user.
        :return: None
        N((Rtdisplay((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytlog_transport_activityscK@sdS(sShow a warning to the user.

        This is specifically for things that are under the user's control (eg
        outdated formats), not for internal program warnings like deprecated
        APIs.

        This can be overridden by UIFactory subclasses to show it in some 
        appropriate way; the default UIFactory is noninteractive and does
        nothing.  format_user_warning maps it to a string, though other
        presentations can be used for particular UIs.

        :param warning_id: An identifier like 'cross_format_fetch' used to 
            check if the message is suppressed and to look up the string.
        :param message_args: Arguments to be interpolated into the message.
        N((RR_R`((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRpscC@st|jdS(sShow an error message (not an exception) to the user.
        
        The message should not have an error prefix or trailing newline.  That
        will be added by the factory if appropriate.
        N(R?t
show_error(RRf((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRwscC@st|jdS(sShow a message to the user.N(R?tshow_message(RRf((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRxscC@st|jdS(sShow a warning to the user.N(R?tshow_warning(RRf((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRysN(!R!R'R(tdictR]RR6R;R=R#R@RBRRPRLRUR[RYR\R7RdReR>RkRmR.RtR4RvRpRwRxRy(((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR)sF										
	
					
	
				
			tNoninteractiveUIFactorycB@s eZdZdZdZRS(s Base class for UIs with no user.cC@stS(N(RK(RR$R%R&((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR#scC@sd|jjfS(Ns%s()(R R!(R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR"s(R!R'R(R#R"(((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR{s	tSilentUIFactorycB@sMeZdZdZdZdZdZdZdZdZ	RS(s%A UI Factory which never prints anything.

    This is the default UI, if another one is never registered by a program
    using bzrlib, and it's also active for example inside 'bzr serve'.

    Methods that try to read from the user raise an error; methods that do
    output do nothing.
    cC@stj|dS(N(R)R(R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRscC@sdS(N((RRf((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytnotescK@sdS(N(R(RR$RA((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytget_usernamescC@s
t|S(N(tNullOutputStream(RRMRN((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRLscC@sdS(N((RRf((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRwscC@sdS(N((RRf((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRxscC@sdS(N((RRf((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRys(
R!R'R(RR}R~RLRwRxRy(((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR|s						tCannedInputUIFactorycB@sYeZdZdZdZdZdZdZddZdZ	d	Z
RS(
s%A silent UI that return canned input.cC@s
||_dS(N(t	responses(RR((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRscC@sd|jj|jfS(Ns%s(%r)(R R!R(R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR"scC@s|j||S(N(R>(RR$R%targs((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR#scC@s|jjdS(Ni(Rtpop(RR$((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR>scC@s|jjdS(Ni(RR(RR$((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRksucK@s|jjdS(Ni(RR(RR$RA((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR@scK@s|jjdS(Ni(RR(RR$RA((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR~scC@s#|jrtd|fndS(Ns'expected all input in %r to be consumed(RtAssertionError(R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytassert_all_input_consumeds	(R!R'R(RR"R#R>RkR@R~R(((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRs						cC@s ddlm}||||S(sGConstruct and return a suitable UIFactory for a text mode program.
    i(t
TextUIFactory(tbzrlib.ui.textR(tstdintstdouttstderrR((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytmake_ui_for_terminalsRlcB@s5eZdZdZdZdZedZRS(s(Soak up and ignore progress information.cC@sdS(N((R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytclearscC@sdS(N((RRZ((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyt
show_progressscC@sdS(N((RRqRsRr((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytshow_transport_activityscC@sdS(N((RRu((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRvs(R!R'R(RRRR4Rv(((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyRls
			RcB@s2eZdZdZdZdZdZRS(s)Acts like a file, but discard all output.cC@s
||_dS(N(RM(RRM((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR$scC@sdS(N((Rtdata((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytwrite'scC@sdS(N((RR((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyt
writelines*scC@sdS(N((R((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pytclose-s(R!R'R(RRRR(((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyR!s
			(R(t
__future__RRVtbzrlib.lazy_importRtglobalsRzRKR4R
RRtobjectRR)R{R|Rt
ui_factoryRRlR(((s6/usr/lib/python2.7/dist-packages/bzrlib/ui/__init__.pyt<module>*s,	

$9
 			

Copyright © 2017 || Recoded By Mr.Bumblebee