/usr/local/lib64/python3.6/site-packages/flask/__pycache__
NameSizeModeActions
app.cpython-36.pyc628380644editdlrm
blueprints.cpython-36.pyc218950644editdlrm
cli.cpython-36.pyc268820644editdlrm
config.cpython-36.pyc115620644editdlrm
ctx.cpython-36.pyc154410644editdlrm
debughelpers.cpython-36.pyc63770644editdlrm
globals.cpython-36.pyc17420644editdlrm
helpers.cpython-36.pyc270040644editdlrm
logging.cpython-36.pyc24000644editdlrm
scaffold.cpython-36.pyc247450644editdlrm
sessions.cpython-36.pyc135440644editdlrm
signals.cpython-36.pyc23320644editdlrm
templating.cpython-36.pyc54490644editdlrm
testing.cpython-36.pyc90890644editdlrm
typing.cpython-36.pyc13630644editdlrm
views.cpython-36.pyc49100644editdlrm
wrappers.cpython-36.pyc49010644editdlrm
__init__.cpython-36.pyc18390644editdlrm
__main__.cpython-36.pyc1700644editdlrm
Edit: /usr/local/lib64/python3.6/site-packages/flask/__pycache__/blueprints.cpython-36.pyc (21895B)
3 ^TBg\@sddlZddlZddlmZddlmZddlmZddlm Z ddlm Z ddlm Z dd lm Z dd lm Z dd lmZdd lmZdd lmZddlmZddlmZddlmZddlmZejrddlmZddlmZejdgejfZGdddZGddde ZdS)N) defaultdict)update_wrapper)_endpoint_from_view_func) _sentinel)Scaffold)AfterRequestCallable)BeforeFirstRequestCallable)BeforeRequestCallable)TeardownCallable) TemplateContextProcessorCallable)TemplateFilterCallable)TemplateGlobalCallable)TemplateTestCallable)URLDefaultCallable)URLValuePreprocessorCallable)Flask)ErrorHandlerCallableBlueprintSetupStatec@sPeZdZdZddejeddddZd eej eej ej ejddd d Z dS) rzTemporary holder object for registering a blueprint with the application. An instance of this class is created by the :meth:`~flask.Blueprint.make_setup_state` method and later passed to all register callback functions. BlueprintrN) blueprintappoptionsfirst_registrationreturncCs||_||_||_||_|jjd}|dkr4|jj}||_|jjd}|dkrV|jj}||_|jjd|j|_|jjdd|_t |jj |_ |j j |jjdfdS)N subdomain url_prefixname name_prefix url_defaults) rrrrgetrrrrdicturl_values_defaultsr update)selfrrrrrrr&1/tmp/pip-build-0s3hx122/flask/flask/blueprints.py__init__"s   zBlueprintSetupState.__init__)ruleendpoint view_funcrrcKs|jdk r2|r,dj|jjd|jdf}n|j}|jd|j|dkrPt|}|j}d|krpt|f|j d}|j j ||j d|j d|jd|fd|i|dS)zA helper method to register a rule (and optionally a view function) to the application. The endpoint is automatically prefixed with the blueprint's name. N/rdefaults.)rjoinrstriplstrip setdefaultrrr r"popr add_url_rulerr)r%r)r*r+rr-r&r&r'r4Ps z BlueprintSetupState.add_url_rule)NN) __name__ __module__ __qualname____doc__tAnyboolr(strOptionalCallabler4r&r&r&r'rs+c seZdZdZdZdZdZdZdddddddefe e e j e j e e jfe j e e j e e j e e j e e j ee j e e j e d fdd Zeddd Ze jdd d d Ze jdd d dZde j e e jegefdddZd?ee j e ddd d!Zd@e j e e jegefdd"d#Z dAee j e ddd$d%Z!dBe j e e je"ge"fdd&d'Z#dCe"e j e ddd(d)Z$e%e%d*d+d,Z&e'e'd*d-d.Z(e)e)d*d/d0Z*e+e+d*d1d2Z,e-e-d*d3d4Z.e j e j/e0e1fe jd5d6d7Z2e3e3d*d8d9Z4e5e5d*d:d;Z6Z7S)Dra Represents a blueprint, a collection of routes and other app-related functions that can be registered on a real application later. A blueprint is an object that allows defining application functions without requiring an application object ahead of time. It uses the same decorators as :class:`~flask.Flask`, but defers the need for an application by recording them for later registration. Decorating a function with a blueprint creates a deferred function that is called with :class:`~flask.blueprints.BlueprintSetupState` when the blueprint is registered on an application. See :doc:`/blueprints` for more information. :param name: The name of the blueprint. Will be prepended to each endpoint name. :param import_name: The name of the blueprint package, usually ``__name__``. This helps locate the ``root_path`` for the blueprint. :param static_folder: A folder with static files that should be served by the blueprint's static route. The path is relative to the blueprint's root path. Blueprint static files are disabled by default. :param static_url_path: The url to serve static files from. Defaults to ``static_folder``. If the blueprint does not have a ``url_prefix``, the app's static route will take precedence, and the blueprint's static files won't be accessible. :param template_folder: A folder with templates that should be added to the app's template search path. The path is relative to the blueprint's root path. Blueprint templates are disabled by default. Blueprint templates have a lower precedence than those in the app's templates folder. :param url_prefix: A path to prepend to all of the blueprint's URLs, to make them distinct from the rest of the app's routes. :param subdomain: A subdomain that blueprint routes will match on by default. :param url_defaults: A dict of default values that blueprint routes will receive by default. :param root_path: By default, the blueprint will automatically set this based on ``import_name``. In certain situations this automatic detection can fail, so the path can be specified manually instead. .. versionchanged:: 1.1.0 Blueprints have a ``cli`` group to register nested CLI commands. The ``cli_group`` parameter controls the name of the group under the ``flask`` command. .. versionadded:: 0.7 FN) r import_name static_folderstatic_url_pathtemplate_folderrrr root_path cli_groupc s`tj||||| dd|kr&td||_||_||_g|_|dkrJi}||_| |_g|_ dS)N)r?r@rArBrCr.z+'name' may not contain a dot '.' character.) superr( ValueErrorrrrdeferred_functionsr#rD _blueprints) r%rr?r@rArBrrr rCrD) __class__r&r'r(s" zBlueprint.__init__)rcCs |jo |jS)N)warn_on_modifications_got_registered_once)r%r&r&r'_is_setup_finishedszBlueprint._is_setup_finished)funcrcCs4|jr$|jr$ddlm}|td|jj|dS)zRegisters a function that is called when the blueprint is registered on the application. This function is called with the state as argument as returned by the :meth:`make_setup_state` method. r)warnzfThe blueprint was already registered once but is getting modified now. These changes will not show up.N)rKrJwarningsrNWarningrGappend)r%rMrNr&r&r'records   zBlueprint.recordcs$tddfdd }|jt|S)zWorks like :meth:`record` but wraps the function in another function that will ensure the function is only called once. If the blueprint is registered a second time on the application, the function passed is not called. N)statercs|jr|dS)N)r)rS)rMr&r'wrappersz&Blueprint.record_once..wrapper)rrRr)r%rMrTr&)rMr' record_onceszBlueprint.record_oncer)rrrrcCst||||S)zCreates an instance of :meth:`~flask.blueprints.BlueprintSetupState` object that is later passed to the register callback functions. Subclasses can override this to return a subclass of the setup state. )r)r%rrrr&r&r'make_setup_stateszBlueprint.make_setup_state)rrrcKs$||krtd|jj||fdS)aRegister a :class:`~flask.Blueprint` on this blueprint. Keyword arguments passed to this method will override the defaults set on the blueprint. .. versionchanged:: 2.0.1 The ``name`` option can be used to change the (pre-dotted) name the blueprint is registered with. This allows the same blueprint to be registered multiple times with unique names for ``url_for``. .. versionadded:: 2.0 z%Cannot register a blueprint on itselfN)rFrHrQ)r%rrr&r&r'register_blueprints zBlueprint.register_blueprint)rrrcs"|jdd}|jdj}|d|jd|jkr|krLddnd}|jk rvtd|d|d n$d d l}|jd|d |d ddtfdd|jjD }|jk}|j<d_ j |||} j r| j j djdd|s|rfdd} xVjjD]H\} } | d kr<n d| } ttdd| jD} | |j| <q&Wx"jjD]\} }||j| <q~W| j|j| j|j| j|j| j|j| j|j| j|jxjD]}|| qW|jdj}jjrr|d kr:|jjjjjn8|tkr\j_|jj jn|j_|jj jxj!D]\}}|j"}|jd}|d kr|j#}| j#d k r|d k r| j#j$dd|jd|d<n*|d k r||d<n| j#d k r| j#|d<|d<|j%||qzWd S)a\Called by :meth:`Flask.register_blueprint` to register all views and callbacks registered on the blueprint with the application. Creates a :class:`.BlueprintSetupState` and calls each :meth:`record` callback with it. :param app: The application this blueprint is being registered with. :param options: Keyword arguments forwarded from :meth:`~Flask.register_blueprint`. .. versionchanged:: 2.0.1 Nested blueprints are registered with their dotted name. This allows different blueprints with the same name to be nested at different locations. .. versionchanged:: 2.0.1 The ``name`` option can be used to change the (pre-dotted) name the blueprint is registered with. This allows the same blueprint to be registered multiple times with unique names for ``url_for``. .. versionchanged:: 2.0.1 Registering the same blueprint with the same name multiple times is deprecated and will become an error in Flask 2.1. rrrr.z ''z The name 'z1' is already registered for a different blueprintz'. Use 'name=' to provide a unique name.rNz*' is already registered for this blueprintzO. Use 'name=' to provide a unique name. This will become an error in Flask 2.1.) stacklevelc3s|]}|kVqdS)Nr&).0Zbp)r%r&r' Asz%Blueprint.register..Tz/Zstatic)r+r*csBx<|jD]0\}}|dkrn d|}||j|q WdS)Nr.)itemsextend)Zbp_dictZ parent_dictkeyvalues)rr&r'r^Rsz"Blueprint.register..extendcSs$i|]\}}dd|jD|qS)cSsi|]\}}||qSr&r&)r[Z exc_classrMr&r&r' \sz1Blueprint.register...)r])r[codeZ code_valuesr&r&r'ra[sz&Blueprint.register..rDrr,)&r!rr1Z blueprintsrFrOrNanyr`rKrVZhas_static_folderr4rAZsend_static_fileZerror_handler_specr]rr"Zview_functionsbefore_request_funcsafter_request_funcsteardown_request_funcsurl_default_functionsurl_value_preprocessorstemplate_context_processorsrGrDclicommandsr$rZ add_commandrHcopyrr0register)r%rrrZ self_nameZ existing_atrOZfirst_bp_registrationZfirst_name_registrationrSr^r_valuer*rMdeferredZcli_resolved_grouprZ bp_optionsZ bp_url_prefixr&)rr%r'rms                  zBlueprint.register)r)r*r+provide_automatic_optionsrrc sRrdkrtdr4tdr4djkr4td|jfdddS)zLike :meth:`Flask.add_url_rule` but for a blueprint. The endpoint for the :func:`url_for` function is prefixed with the name of the blueprint. r.z/'endpoint' may not contain a dot '.' character.r5z5'view_func' name may not contain a dot '.' character.cs|jfdiS)Nrp)r4)s)r*rrpr)r+r&r's z(Blueprint.add_url_rule..N)rFhasattrr5rR)r%r)r*r+rprr&)r*rrpr)r+r'r4s zBlueprint.add_url_rule)rrcsttdfdd }|S)zRegister a custom template filter, available application wide. Like :meth:`Flask.template_filter` but for a blueprint. :param name: the optional name of the filter, otherwise the function name will be used. )frcsj|d|S)N)r)add_app_template_filter)rt)rr%r&r' decoratorsz0Blueprint.app_template_filter..decorator)r )r%rrvr&)rr%r'app_template_filters zBlueprint.app_template_filter)rtrrcs$tddfdd }|j|dS)aIRegister a custom template filter, available application wide. Like :meth:`Flask.add_template_filter` but for a blueprint. Works exactly like the :meth:`app_template_filter` decorator. :param name: the optional name of the filter, otherwise the function name will be used. N)rSrcs|jjjpj<dS)N)r jinja_envfiltersr5)rS)rtrr&r'register_templatesz.register_template)rrU)r%rtrrzr&)rtrr'rus z!Blueprint.add_app_template_filtercsttdfdd }|S)aRegister a custom template test, available application wide. Like :meth:`Flask.template_test` but for a blueprint. .. versionadded:: 0.10 :param name: the optional name of the test, otherwise the function name will be used. )rtrcsj|d|S)N)r)add_app_template_test)rt)rr%r&r'rvsz.Blueprint.app_template_test..decorator)r)r%rrvr&)rr%r'app_template_tests zBlueprint.app_template_testcs$tddfdd }|j|dS)aaRegister a custom template test, available application wide. Like :meth:`Flask.add_template_test` but for a blueprint. Works exactly like the :meth:`app_template_test` decorator. .. versionadded:: 0.10 :param name: the optional name of the test, otherwise the function name will be used. N)rSrcs|jjjpj<dS)N)rrxtestsr5)rS)rtrr&r'rzsz:Blueprint.add_app_template_test..register_template)rrU)r%rtrrzr&)rtrr'r{s zBlueprint.add_app_template_testcsttdfdd }|S)aRegister a custom template global, available application wide. Like :meth:`Flask.template_global` but for a blueprint. .. versionadded:: 0.10 :param name: the optional name of the global, otherwise the function name will be used. )rtrcsj|d|S)N)r)add_app_template_global)rt)rr%r&r'rvsz0Blueprint.app_template_global..decorator)r)r%rrvr&)rr%r'app_template_globals zBlueprint.app_template_globalcs$tddfdd }|j|dS)aiRegister a custom template global, available application wide. Like :meth:`Flask.add_template_global` but for a blueprint. Works exactly like the :meth:`app_template_global` decorator. .. versionadded:: 0.10 :param name: the optional name of the global, otherwise the function name will be used. N)rSrcs|jjjpj<dS)N)rrxglobalsr5)rS)rtrr&r'rzsz.register_template)rrU)r%rtrrzr&)rtrr'r~s z!Blueprint.add_app_template_global)rtrcs|jfddS)zLike :meth:`Flask.before_request`. Such a function is executed before each request, even if outside of a blueprint. cs|jjjdgjS)N)rrdr2rQ)rq)rtr&r'rrsz.Blueprint.before_app_request..)rU)r%rtr&)rtr'before_app_requestszBlueprint.before_app_requestcs|jfddS)zLike :meth:`Flask.before_first_request`. Such a function is executed before the first request to the application. cs|jjjS)N)rZbefore_first_request_funcsrQ)rq)rtr&r'rr%sz4Blueprint.before_app_first_request..)rU)r%rtr&)rtr'before_app_first_requestsz"Blueprint.before_app_first_requestcs|jfddS)zLike :meth:`Flask.after_request` but for a blueprint. Such a function is executed after each request, even if outside of the blueprint. cs|jjjdgjS)N)rrer2rQ)rq)rtr&r'rr-sz-Blueprint.after_app_request..)rU)r%rtr&)rtr'after_app_request(szBlueprint.after_app_requestcs|jfddS)zLike :meth:`Flask.teardown_request` but for a blueprint. Such a function is executed when tearing down each request, even if outside of the blueprint. cs|jjjdgjS)N)rrfr2rQ)rq)rtr&r'rr7sz0Blueprint.teardown_app_request..)rU)r%rtr&)rtr'teardown_app_request1szBlueprint.teardown_app_requestcs|jfddS)zLike :meth:`Flask.context_processor` but for a blueprint. Such a function is executed each request, even if outside of the blueprint. cs|jjjdgjS)N)rrir2rQ)rq)rtr&r'rrBsz1Blueprint.app_context_processor..)rU)r%rtr&)rtr'app_context_processor;szBlueprint.app_context_processor)rbrcsdddfdd }|S)zLike :meth:`Flask.errorhandler` but for a blueprint. This handler is used for all requests, even if outside of the blueprint. zErrorHandlerCallable[Exception])rtrcsjfddS)Ncs|jjS)N)rZ errorhandler)rq)rbrtr&r'rrNsz?Blueprint.app_errorhandler..decorator..)rU)rt)rbr%)rtr'rvKsz-Blueprint.app_errorhandler..decoratorr&)r%rbrvr&)rbr%r'app_errorhandlerFszBlueprint.app_errorhandlercs|jfddS)z.)rU)r%rtr&)rtr'app_url_value_preprocessorSsz$Blueprint.app_url_value_preprocessorcs|jfddS)z2Same as :meth:`url_defaults` but application wide.cs|jjjdgjS)N)rrgr2rQ)rq)rtr&r'rr_sz,Blueprint.app_url_defaults..)rU)r%rtr&)rtr'app_url_defaults\szBlueprint.app_url_defaults)F)NNN)N)N)N)N)N)N)8r5r6r7r8rJrKZ json_encoderZ json_decoderrr<r9r=UnionosPathLiker"r(r;rLr>rRrUrrVr:rWrmr4r rwrurr|r{rrr~r rr rrrr rr rType Exceptionintrrrrr __classcell__r&r&)rIr'rpsb3d          "r)rZtypingr9 collectionsr functoolsrZscaffoldrrrrr r r r r rrrrZ TYPE_CHECKINGrrrr>ZDeferredSetupFunctionrrr&r&r&r's,                 U