if a textcoin was not claimed for 'days' days, claims it back
184126
function claimBackOldTextcoins(to_address, days){
	db.query(
		"SELECT mnemonic FROM sent_mnemonics LEFT JOIN unit_authors USING(address) \n\
		WHERE mnemonic!='' AND unit_authors.address IS NULL AND creation_date<"+db.addTime("-"+days+" DAYS"),
		function(rows){
			async.eachSeries(
				rows,
				function(row, cb){
					receiveTextCoin(row.mnemonic, to_address, function(err, unit, asset){
						if (err)
							console.log("failed claiming back old textcoin "+row.mnemonic+": "+err);
						else
							console.log("claimed back mnemonic "+row.mnemonic+", unit "+unit+", asset "+asset);
						cb();
					});
				}
			);
		}
	);
}
672087
function( tmp ) {
      if ( tmp.val === '' ) return true; // allow empty because empty check does by required metheod
      var reg, cardNumber, pos, digit, i, sub_total, sum = 0, strlen;
      reg = new RegExp( /[^0-9]+/g );
      cardNumber = tmp.val.replace( reg, '' );
      strlen = cardNumber.length;
      if( strlen < 13 ) return messages.creditCard;
      for( i=0 ; i < strlen ; i++ ) {
        pos = strlen - i;
        digit = parseInt( cardNumber.substring( pos - 1, pos ), 10 );
        if( i % 2 === 1 ) {
          sub_total = digit * 2 ;
          if( sub_total > 9 ) {
            sub_total = 1 + ( sub_total - 10 );
          }
        } else {
          sub_total = digit ;
        }
        sum += sub_total ;
      }
      if( sum > 0 && sum % 10 === 0 ) return true;
      return messages.creditCard;
    }
809044
def IsAllSpent(self):
        
        for item in self.Items:
            if item == CoinState.Confirmed:
                return False
        return True
252294
def previous_day(self):
        """"""
        return HDate(self.gdate + datetime.timedelta(-1), self.diaspora,
                     self.hebrew)
1103309
def xclaim(self, stream, group_name, consumer_name, min_idle_time,
               id, *ids):
        """"""
        fut = self.execute(
            b'XCLAIM', stream, group_name, consumer_name, min_idle_time,
            id, *ids
        )
        return wait_convert(fut, parse_messages)
518155
async def Claim(self, claims):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Singular',
                   request='Claim',
                   version=2,
                   params=_params)
        _params['claims'] = claims
        reply = await self.rpc(msg)
        return reply
580462
function Claim(ttl, tracing) {
    this.type = Claim.TypeCode;
    this.ttl = ttl || 0;
    this.tracing = tracing || Tracing.emptyTracing;
}
351679
def flag_forgotten_entries(session, today=None):
     # noqa
    today = date.today() if today is None else today

    forgotten = (
        session
        .query(Entry)
        .filter(Entry.time_out.is_(None))
        .filter(Entry.forgot_sign_out.is_(False))
        .filter(Entry.date < today)
    )

    for entry in forgotten:
        e = sign_out(entry, forgot=True)
        logger.debug('Signing out forgotten entry: {}'.format(e))
        session.add(e)

    session.commit()
939732
def reset_token(self, **params):
        
        response = self.claim_token(**params)
        if not self.user:
            return response

        self.user.api_key.reset_token()
        headers = remember(self.request, self.user.username)
        return JHTTPOk('Registered', headers=headers)
385190
async def get_frozen(self, *args, **kwargs):
		
		super().validate(*args, **kwargs)

		if kwargs.get("message"):
			kwargs = json.loads(kwargs.get("message"))

		# Get daya from request
		coinids = kwargs.get("coinids")
		uid = kwargs.get("uid")
		address = kwargs.get("address")
		# Check if required fields exists

		try:
			coinid = coinid.replace("TEST", "")
		except:
			pass

		try:
			uid = int(uid)
		except:
			return await self.error_400("User id must be integer. ")

		if not uid and address:
			uid = await self.get_uid_by_address(address=address, coinid=coinid)
			if isinstance(uid, dict):
				return uid

		if not all([types, uid]):
			return await self.error_400("Get frozen. Missed required fields.")
		if isinstance(types, list):
			actives = {}
			for coinid in coinids:
				database = self.client[self.collection]
				collection = database[coinid]
				# Get current balance
				balance = await collection.find_one({"uid":uid})
				if not balance:
					return await self.error_404(
						"Get frozen. Balance with uid:%s and type:%s not found" % (uid, coinid))
				# Collect actives
				actives[coinid] = int(balance["amount_frozen"])

		if isinstance(coinids, str):
			actives = {}
			for coinid in self.types:
				database = self.client[coinid]
				collection = database[self.collection]
				# Get current balance
				balance = await collection.find_one({"uid":uid})
				if not balance:
					return await self.error_404(
						"Get frozen. Balance with uid:%s and type:%s not found" % (uid, coinid))
				# Collect actives
				actives[coinid] = int(balance["amount_frozen"])
		return actives
860786
def _selftoken_expired():
    '''
    
    '''
    try:
        verify = __opts__['vault'].get('verify', None)
        url = '{0}/v1/auth/token/lookup-self'.format(__opts__['vault']['url'])
        if 'token' not in __opts__['vault']['auth']:
            return True
        headers = {'X-Vault-Token': __opts__['vault']['auth']['token']}
        response = requests.get(url, headers=headers, verify=verify)
        if response.status_code != 200:
            return True
        return False
    except Exception as e:
        raise salt.exceptions.CommandExecutionError(
            'Error while looking up self token : {0}'.format(six.text_type(e))
            )
321633
def move_if_not_on_dow(original, replacement, dow_not_orig, dow_replacement):
    
    return lambda x: (
        (x.hdate.day == original and x.gdate.weekday() != dow_not_orig) or
        (x.hdate.day == replacement and x.gdate.weekday() == dow_replacement))
363169
async def processClaim(self, schemaId: ID, claimAttributes: Dict[str, ClaimAttributeValues], signature: Claims):
        
        await self.wallet.submitContextAttr(schemaId, signature.primaryClaim.m2)
        await self.wallet.submitClaimAttributes(schemaId, claimAttributes)

        await self._initPrimaryClaim(schemaId, signature.primaryClaim)
        if signature.nonRevocClaim:
            await self._initNonRevocationClaim(schemaId, signature.nonRevocClaim)
991221
def lock_account(self, minutes=30):
        
        period = datetime.timedelta(minutes=minutes)
        self.locked_until = datetime.datetime.utcnow() + period
401199
def ledger(self):
        """"""
        self.balance()  # make sure the transaction balances

        s = "{0}/{1:02}/{2:02}  {3}\n".format(
            self.date.year,
            self.date.month,
            self.date.day,
            self.desc.replace('\n', ' ')
        )
        for src in self.src:
            s += "  {0.account}  ${0.amount}\n".format(src)
        for dst in self.dst:
            s += "  {0.account}  ${0.amount}\n".format(dst)
        return s
764438
function dateLastPaymentWasReceived(loan, cb) {
    var d = Q.defer();
    var last;
    if (!loan) {
      d.reject('required parameters for dateLastPaymentWasReceived not provided');
    }

    var paymentTxs = loan.transactions.filter(function (tx) {
      return tx.type !== 'Late Fee';
    });

    last = _.max(paymentTxs, function (rec) {
      return rec.txDate;
    });

    loan.dateLastPaymentWasReceived = last.txDate || loan.closingDate;
    d.resolve(loan);
    if (cb) return cb(loan);
    return d.promise;
  }
1247632
def FromTXOutputsConfirmed(outputs):
        
        uns = UnspentCoinState()
        uns.Items = [0] * len(outputs)
        for i in range(0, len(outputs)):
            uns.Items[i] = int(CoinState.Confirmed)
        return uns