Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
odigos / etc / odigos-vmagent / instrumentations / python / asgiref / __pycache__ / server.cpython-311.pyc
Size: Mime:
§

Öguãól—ddlZddlZddlZddlZddlmZeje¦«ZGd„d¦«Z	dS)éNé)Úguarantee_single_callablecóN—eZdZdZdZdd„Zd„Zd„Zd„Zd„Z	d	„Z
d
„Zd„Zd„Z
d
S)ÚStatelessServerax
    Base server class that handles basic concepts like application instance
    creation/pooling, exception handling, and similar, for stateless protocols
    (i.e. ones without actual incoming connections to the process)

    Your code should override the handle() method, doing whatever it needs to,
    and calling get_or_create_application_instance with a unique `scope_id`
    and `scope` for the scope it wants to get.

    If an application instance is found with the same `scope_id`, you are
    given its input queue, otherwise one is made for you with the scope provided
    and you are given that fresh new input queue. Either way, you should do
    something like:

    input_queue = self.get_or_create_application_instance(
        "user-123456",
        {"type": "testprotocol", "user_id": "123456", "username": "andrew"},
    )
    input_queue.put_nowait(message)

    If you try and create an application instance and there are already
    `max_application` instances, the oldest/least recently used one will be
    reclaimed and shut down to make space.

    Application coroutines that error will be found periodically (every 100ms
    by default) and have their exceptions printed to the console. Override
    application_exception() if you want to do more when this happens.

    If you override run(), make sure you handle things like launching the
    application checker.
    gš™™™™™¹?éècó0—||_||_i|_dS©N)ÚapplicationÚmax_applicationsÚapplication_instances)Úselfr
rs   ú5/tmp/pip-target-6culloxw/lib/python/asgiref/server.pyÚ__init__zStatelessServer.__init__.s €à&ˆÔØ 0ˆÔà%'ˆÔ"Ð"Ð"ócó—tj¦«}tj| ¦«¦«	| | ¦«¦«dS#t$rt d¦«YdSwxYw)zD
        Runs the asyncio event loop with our handler loop.
        zExiting due to Ctrl-C/interruptN)	ÚasyncioÚget_event_loopÚ
ensure_futureÚapplication_checkerÚrun_until_completeÚhandleÚKeyboardInterruptÚloggerÚinfo)r
Ú
event_loops  rÚrunzStatelessServer.run7s€õÔ+Ñ-Ô-ˆ
ÝÔ˜d×6Ò6Ñ8Ô8Ñ9Ô9Ð9ð	;Ø×)Ò)¨$¯+ª+©-¬-Ñ8Ô8Ð8Ð8Ð8øÝ ð	;ð	;ð	;ÝKŠKÐ9Ñ:Ô:Ð:Ð:Ð:Ð:ð	;øøøs»'A$Á$$BÂBcƒó$K—td¦«‚)NzYou must implement handle()©ÚNotImplementedError)r
s rrzStatelessServer.handleBsèè€Ý!Ð"?Ñ@Ô@Ð@rcƒó$K—td¦«‚)zM
        Receives outbound sends from applications and handles them.
        z%You must implement application_send()r)r
ÚscopeÚmessages   rÚapplication_sendz StatelessServer.application_sendEsèè€õ"Ð"IÑJÔJÐJrc󇇗|‰jvr4tj¦«‰j|d<‰j|dSt‰j¦«‰jkr1‰ ¦«t‰j¦«‰jk°1tj¦«}t‰j¦«}tj	|‰|j
ˆˆfd„¬¦«¦«}||‰tj¦«dœ‰j|<|S)zH
        Creates an application instance and returns its queue.
        Ú	last_usedÚinput_queuecó0•—‰ ‰|¦«Sr	)r#)r"r!r
s €€rú<lambda>zDStatelessServer.get_or_create_application_instance.<locals>.<lambda>_sø€ T×%:Ò%:¸5À'Ñ%JÔ%J€r)r!ÚreceiveÚsend)r&Úfuturer!r%)rÚtimeÚlenrÚ"delete_oldest_application_instancerÚQueuerr
rÚget)r
Úscope_idr!r&Úapplication_instancer+s` `   rÚ"get_or_create_application_instancez2StatelessServer.get_or_create_application_instanceMsøø€ðtÔ1Ð1Ð1Ý@DÄ	ÁĈDÔ& xÔ0°Ñ=ØÔ-¨hÔ7¸
ÔFÐFå$Ô,Ñ-Ô-°Ô0EÒEÐEØ×3Ò3Ñ5Ô5Ð5õ$Ô,Ñ-Ô-°Ô0EÒEÐEõ”m‘o”oˆÝ8¸Ô9IÑJÔJÐåÔ&Ø Ð ØØ#œØJÐJÐJÐJÐJð
ñ
ô
ñ
ô
ˆð'ØØÝœ™œð	0
ð0
ˆÔ" 8Ñ,ðÐrcóì—td„|j ¦«D¦«¦«}|j ¦«D])\}}|d|kr| |¦«dSŒ*dS)zC
        Finds and deletes the oldest application instance
        c3ó&K—|]}|dV—Œ
dS)r%N©)Ú.0Údetailss  rú	<genexpr>zEStatelessServer.delete_oldest_application_instance.<locals>.<genexpr>ns8èè€ð
ð
Ø%,ˆGKÔ ð
ð
ð
ð
ð
ð
rr%N)ÚminrÚvaluesÚitemsÚdelete_application_instance)r
Úoldest_timer1r8s    rr.z2StatelessServer.delete_oldest_application_instancejsŸ€õð
ð
Ø04Ô0J×0QÒ0QÑ0SÔ0Sð
ñ
ô
ñ
ô
ˆð"&Ô!;×!AÒ!AÑ!CÔ!Cð	ð	ÑˆHgؐ{Ô# {Ò2Ð2Ø×0Ò0°Ñ:Ô:Ð:ðð	3ð	ð	rcóœ—|j|}|j|=|d ¦«s|d ¦«dSdS)z€
        Removes an application instance (makes sure its task is stopped,
        then removes it from the current set)
        r+N)rÚdoneÚcancel)r
r1r8s   rr=z+StatelessServer.delete_application_instancexs\€ð
Ô,¨XÔ6ˆØÔ& xÐ0ؐxÔ ×%Ò%Ñ'Ô'ð	'ØHÔ×$Ò$Ñ&Ô&Ð&Ð&Ð&ð	'ð	'rcƒóxK—	tj|j¦«ƒd{V—†t|j ¦«¦«D]q\}}|d ¦«rR|d ¦«}|r| ||¦«ƒd{V—†	|j|=Œa#t$rYŒmwxYwŒrŒ¸)zž
        Goes through the set of current application instance Futures and cleans up
        any that are done/prints exceptions for any that errored.
        TNr+)
rÚsleepÚapplication_checker_intervalÚlistrr<r@Ú	exceptionÚapplication_exceptionÚKeyError)r
r1r8rFs    rrz#StatelessServer.application_checker‚søèè€ð
	Ý”- Ô AÑBÔBÐBÐBÐBÐBÐBÐBÐBÝ%)¨$Ô*D×*JÒ*JÑ*LÔ*LÑ%MÔ%Mð	
ð	
Ñ!˜'ؘ8Ô$×)Ò)Ñ+Ô+ðØ '¨Ô 1× ;Ò ;Ñ =Ô =IØ ðMØ"×8Ò8¸ÀGÑLÔLÐLÐLÐLÐLÐLÐLÐLðØ Ô6°xÐ@Ð@øÝ#ðððà˜ðøøøð
ð	sÂ!B*Â*
B7Â6B7c	ƒó’K—tjd|d tj|j¦«¦«d|›¦«dS)zL
        Called whenever an application coroutine has an exception.
        z%Exception inside application: %s
%s%sÚz  N)ÚloggingÚerrorÚjoinÚ	tracebackÚ	format_tbÚ
__traceback__)r
rFÚapplication_detailss   rrGz%StatelessServer.application_exception”sTèè€õ	Œ
Ø4ØØGŠG•IÔ'¨	Ô(?Ñ@Ô@ÑAÔAØÐÐñ		
ô	
ð	
ð	
ð	
rN)r)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rDrrrr#r3r.r=rrGr6rrrrs¹€€€€€ððð@$'Ð ð(ð(ð(ð(ð	;ð	;ð	;ðAðAðAðKðKðKðððð:ððð'ð'ð'ðððð$	
ð	
ð	
ð	
ð	
rr)
rrKr,rNÚ
compatibilityrÚ	getLoggerrRrrr6rrú<module>rXsŒðØ€€€Ø€€€Ø€€€ØÐÐÐà4Ð4Ð4Ð4Ð4Ð4à	ˆÔ	˜8Ñ	$Ô	$€ðR
ðR
ðR
ðR
ðR
ñR
ôR
ðR
ðR
ðR
r