pymensago/keycard.py
def is_expired(self) -> RetVal:
		'''Checks if the entry is expired'''
		if 'Expires' not in self.fields.keys():
			return RetVal(RequiredFieldMissing, 'Expires')
		
		m = re.match(r'^([0-9]{4})([0-9]{2})([0-9]{2})$', self.fields['Expires'])
		if not m or not _is_valid_date(int(m[2]), int(m[3]), int(m[1])):
			return RetVal(ErrBadData, 'bad expiration date')
		expire_time = datetime.datetime(int(m[1]), int(m[2]), int(m[3]),
			tzinfo=datetime.timezone(datetime.timedelta(hours=0)))

		if datetime.datetime.now() > expire_time:
			return RetVal(ErrBadData, 'entry is expired')

		return RetVal()
Checks if the entry is expired
Checks if the entry is expired
Checks if the entry is expired
def is_expired(self) -> RetVal:
		if 'Expires' not in self.fields.keys():
			return RetVal(RequiredFieldMissing, 'Expires')
		m = re.match(r'^([0-9]{4})([0-9]{2})([0-9]{2})$', self.fields['Expires'])
		if not m or not _is_valid_date(int(m[2]), int(m[3]), int(m[1])):
			return RetVal(ErrBadData, 'bad expiration date')
		expire_time = datetime.datetime(int(m[1]), int(m[2]), int(m[3]),
			tzinfo=datetime.timezone(datetime.timedelta(hours=0)))
		if datetime.datetime.now() > expire_time:
			return RetVal(ErrBadData, 'entry is expired')
		return RetVal()
def is_expired ( self ) -> RetVal : if 'Expires' not in self . fields . keys ( ) : return RetVal ( RequiredFieldMissing , 'Expires' ) m = re . match ( r'^([0-9]{4})([0-9]{2})([0-9]{2})$' , self . fields [ 'Expires' ] ) if not m or not _is_valid_date ( int ( m [ 2 ] ) , int ( m [ 3 ] ) , int ( m [ 1 ] ) ) : return RetVal ( ErrBadData , 'bad expiration date' ) expire_time = datetime . datetime ( int ( m [ 1 ] ) , int ( m [ 2 ] ) , int ( m [ 3 ] ) , tzinfo = datetime . timezone ( datetime . timedelta ( hours = 0 ) ) ) if datetime . datetime . now ( ) > expire_time : return RetVal ( ErrBadData , 'entry is expired' ) return RetVal ( )
Checks if the entry is expired
Checks if the entry is expired
'''Checks if the entry is expired'''
self