+
     ho  c                   sL   R t ^ RIHt ^ RIHt ^ RIHt  ! R R4      t ! R R]4      t ! R R	]4      t	]
R
8X  di    ]! 4       t]! ]4       ]^ ,          P                  4       t]P                  4        ]	! . RO4      t]! ]P#                  ]P%                  4       4      4       R# R# )ag  Abstract CarType.

__author__ = "https://www.gemalto.com/"

Copyright 2001-2012 gemalto
Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com

This file is part of pyscard.

pyscard is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

pyscard is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with pyscard; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
)InvalidATRMaskLengthException)readers)toHexStringc                   s4   a  ] tR t^t o RtR tRR ltRtV tR# )CardTypezzAbstract base class for CardTypes.

Known subclasses: L{smartcard.CardType.AnyCardType}
L{smartcard.CardType.ATRCardType}.c                    R# )zCardType constructor.N )selfs   &9/usr/lib64/python3.14/site-packages/smartcard/CardType.py__init__ZCardType.__init__$   s        Nc                r   )a	  Returns true if atr and card connected match the L{CardType}.

@param atr:    the atr to check for matching
@param reader: the reader (optional); default is None

The reader can be used in some subclasses to do advanced
matching that require connecting to the card.Nr   r   atrreader   &&&r   matchesZCardType.matches(   s     	r	   r   N)	__name__
__module____qualname____firstlineno____doc__r   r   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s     *
 r	   r   c                   s@   a a ] tR t^3t oRtV 3R ltRR ltRtVtV ;t	# )AnyCardTypez!The AnyCardType matches any card.c                s$   < \         SV `  4        R # r   )superr   )r   	__class__s   &r   r   ZAnyCardType.__init__6   s    r	   c                r   )zAlways returns true, i.e. AnyCardType matches any card.

@param atr:    the atr to check for matching
@param reader: the reader (optional); default is NoneTr   r
   r   r   r   ZAnyCardType.matches9   s    
 r	   r   r   
r   r   r   r   r   r   r   r   r   Z__classcell__r   r      @@r   r   r   3   s     + r	   r   c                   sD   a a ] tR t^At oRtRV 3R lltRR ltRtVtV ;t	# )ATRCardTypez6The ATRCardType defines a card from an ATR and a mask.c                s`  < \         SV `  4        \        V4      V n        W n        Vf   V P                  V n        R# \        V P                  4      \        V P                  4      8w  d   \        \        V4      4      h\        \        R V P                  V P                  4      4      V n        R# )zATRCardType constructor.
@param atr:    the ATR of the CardType
@param mask:   an optional mask to be applied to the ATR for
    L{CardType} matching default is None
Nc                     W,          # r   r   ZxZy   &&r   <lambda>Z&ATRCardType.__init__.<locals>.<lambda>R   s    15r	   )
r   r   listr   mask	maskedatrlenr    r   map)r   r   r$   r   s   &&&r   r   ZATRCardType.__init__D   sv     	9	<!XXDN488}DII.3K4EFF!#&8$((DII"NODNr	   c                s    \        V4      \        V P                  4      8w  d   R# V P                  e,   \        \	        R \        V4      V P                  4      4      pMTpV P
                  V8H  # )aC  Returns true if the atr matches the masked CardType atr.

@param atr:    the atr to check for matching
@param reader: the reader (optional); default is None

When atr is compared to the CardType ATR, matches returns true if
and only if CardType.atr & CardType.mask = atr & CardType.mask,
where & is the bitwise logical AND.c                 r   r   r   r    r!   r   r"   Z%ATRCardType.matches.<locals>.<lambda>b   s    aer	   F)r&   r   r$   r#   r'   r%   )r   r   r   r%   s   &&& r   r   ZATRCardType.matchesT   sW     s8s488}$O99 S!3T#Y		JKII~~**r	   )r   r$   r%   r   r   r   r   r   r   r   A   s     @P + +r	   r   Z__main__N)	i;   i   i   i    i   i       r(   i   )r   Zsmartcard.Exceptionsr    Zsmartcard.Systemr   Zsmartcard.utilr   r   r   r   r   ZrZprintZcreateConnectionZ
connectionZconnectZatrctr   ZgetATRr   r	   r   <module>r)      s   0 ? $ & *( $+( $+N z;	A	!H1&&(JNOE	%--
))+
,- r	   