
                             S SK Jr  S SKJrJrJr  S SKrS SKrS SKJ	r	  \R                  " \5      r " S S\5      rS\4S jrSS	\\   S\\\4   4S
 jjrg)    )	b64encode)MappingOptional
NamedTupleN)
struct_pb2c                   *    \ rS rSr% \\S'   \\S'   Srg)_Semver   majorminor N)__name__
__module____qualname____firstlineno__int__annotations____static_attributes__r       Glib/third_party/google/cloud/pubsublite/internal/wire/pubsub_context.pyr	   r	      s    JJr   r	   returnc                      [         R                  " S5      R                  n U R                  S5      n[        U5      S:w  a%  [        R                  SU  S35        [        SS5      $ [        [        US   5      [        US   5      5      $ ! [         R                   a$    [        R                  S5        [        SS5      s $ f = f)Nzgoogle-cloud-pubsublitezSFailed to extract the google-cloud-pubsublite semver version. DistributionNotFound.r   .   zFailed to extract semver from    )
pkg_resourcesget_distributionversionDistributionNotFound_LOGGERinfor	   splitlenr   )r   splitss     r   _versionr%      s    001JKSS ]]3F
6{a5gYa@Aq!}3vay>3vay>22 -- a	
 q!}	s    B 5CC	frameworkc                 l   [         R                  " 5       nSUR                  S   l        U (       a  XR                  S   l        [	        5       nUR
                  UR                  S   l        UR                  UR                  S   l        [        UR                  5       5      R                  S5      nSU0$ )z=Construct the pubsub context mapping for the given framework.PYTHONlanguager&   major_versionminor_versionzutf-8zx-goog-pubsub-context)r   Structfieldsstring_valuer%   r   number_valuer   r   SerializeToStringdecode)r&   contextr   encodeds       r   pubsub_contextr4   .   s    !G.6GNN:+3<{#0jG3:==GNN?#03:==GNN?#01134;;GDG#W--r   )N)base64r   typingr   r   r   loggingr   cloudsdk.google.protobufr   	getLoggerr   r    r	   r%   strr4   r   r   r   <module>r;      sc     0 0   / 

H
%j 
3' 3
.hsm 
.wsCx7H 
.r   