Пример #1
0
def r01(t, e):
    i = 0
    n = 0
    for i in range(0, max(len(t), len(e))):
        if i < len(e):
            n += ord(e[i])
        if i < len(t):
            n += ord(t[i])
    h = format(int(hex(n), 16), 'x')
    return h
Пример #2
0
	def r01(self, t, e, token_error=False):
		i = 0
		n = 0
		for i in range(0, max(len(t), len(e))):
			if i < len(e):
				n += ord(e[i])
			if i < len(t):
				n += ord(t[i])
		h = format(int(hex(n),16),'x')
		return h
Пример #3
0
	def r01(self, t, e, token_error=False, use_code=True):
		i = 0
		n = 0
		x = 0
		if use_code == True:
			for i in range(0, max(len(t), len(e))):
				if i < len(e):
					n += ord(e[i])
				if i < len(t):
					n += ord(t[i])
				if i >= len(e):
					x = int(i)
					n += x
		h = format(int(hex(n),16),'x')
		return h
Пример #4
0
# Muck up the names in an effort to confuse...
import logging as renamed_logging
import os as logging
from uninferable import UNINFERABLE

FORMAT_STR = '{0}, {1}'

# Statements that should be flagged:
renamed_logging.debug('{0}, {1}'.format(4, 5)) # [logging-format-interpolation]
renamed_logging.log(renamed_logging.DEBUG, 'msg: {}'.format('Run!')) # [logging-format-interpolation]
renamed_logging.debug(FORMAT_STR.format(4, 5)) # [logging-format-interpolation]
renamed_logging.log(renamed_logging.DEBUG, FORMAT_STR.format(4, 5)) # [logging-format-interpolation]
renamed_logging.info("Read {l} rows".format(l=123456789)) # [logging-format-interpolation]

# Statements that should not be flagged:
renamed_logging.debug(format(66, 'x'))
renamed_logging.debug(builtins.format(66, 'x'))
renamed_logging.log(renamed_logging.DEBUG, 'msg: Run!'.upper())
logging.debug('{0}, {1}'.format(4, 5))
logging.log(logging.DEBUG, 'msg: {}'.format('Run!'))
renamed_logging.info("Read {l:,d} rows".format(l=123456789))
renamed_logging.info(UNINFERABLE.format(l=123456789))


class Logger(renamed_logging.Logger):
    pass

custom_logger = Logger('three')
custom_logger.info('testing {0}'.format('info'))  # [logging-format-interpolation]
custom_logger.info('testing %s' % 'info')  # [logging-not-lazy]
import logging as renamed_logging
import os as logging
from uninferable import UNINFERABLE

FORMAT_STR = '{0}, {1}'

# Statements that should be flagged:
renamed_logging.debug('{0}, {1}'.format(4, 5)) # [logging-format-interpolation]
renamed_logging.log(renamed_logging.DEBUG, 'msg: {}'.format('Run!')) # [logging-format-interpolation]
renamed_logging.debug(FORMAT_STR.format(4, 5)) # [logging-format-interpolation]
renamed_logging.log(renamed_logging.DEBUG, FORMAT_STR.format(4, 5)) # [logging-format-interpolation]
renamed_logging.info("Read {l} rows".format(l=123456789)) # [logging-format-interpolation]

# Statements that should not be flagged:
renamed_logging.debug(format(66, 'x'))
renamed_logging.debug(builtins.format(66, 'x'))
renamed_logging.log(renamed_logging.DEBUG, 'msg: Run!'.upper())
logging.debug('{0}, {1}'.format(4, 5))
logging.log(logging.DEBUG, 'msg: {}'.format('Run!'))
renamed_logging.info("Read {l:,d} rows".format(l=123456789))
renamed_logging.info(UNINFERABLE.format(l=123456789))


class Logger(renamed_logging.Logger):
    pass

custom_logger = Logger('three')

custom_logger.info('testing {0}'.format('info'))  # [logging-format-interpolation]
custom_logger.info('testing %s' % 'info') # [logging-not-lazy]
Пример #6
0
# Statements that should be flagged:
renamed_logging.debug("{0}, {1}".format(4,
                                        5))  # [logging-format-interpolation]
renamed_logging.log(renamed_logging.DEBUG,
                    "msg: {}".format("Run!"))  # [logging-format-interpolation]
renamed_logging.debug(FORMAT_STR.format(4,
                                        5))  # [logging-format-interpolation]
renamed_logging.log(renamed_logging.DEBUG,
                    FORMAT_STR.format(4, 5))  # [logging-format-interpolation]
renamed_logging.info(
    "Read {l} rows".format(l=123456789))  # [logging-format-interpolation]

# Statements that should not be flagged:
renamed_logging.debug(format(66, "x"))
renamed_logging.debug(builtins.format(66, "x"))
renamed_logging.log(renamed_logging.DEBUG, "msg: Run!".upper())
logging.debug("{0}, {1}".format(4, 5))
logging.log(logging.DEBUG, "msg: {}".format("Run!"))
renamed_logging.info("Read {l:,d} rows".format(l=123456789))
renamed_logging.info(UNINFERABLE.format(l=123456789))


class Logger(renamed_logging.Logger):
    pass


custom_logger = Logger("three")

custom_logger.info(
    "testing {0}".format("info"))  # [logging-format-interpolation]
Пример #7
0
testcommand = "QR_ENCODE;Merchant,ID=79723683746862387464" \
     +separatorSuffix+"AUTHTOKEN;Token="+ authtoken.format("000000000000")

#strr = io.open("tinn.png",'a+b')
#judd = base64.encodestring("test")
#jaff = base64.decodestring(testbase64data)
#if strr.writable:
#    strr.write(jaff)
#    strr.flush()
redisURL = os.environ.get("REDIS_URL")
redischannel = 'marc-channel'
timestamp = time.strftime(" %H:%M:%S")
datey = date.today()
r = redis.from_url(redisURL)
print(timestamp)
timeindex = time.strftime("%H%M%S") + separatorSuffix + format(randt, "000000")
print(timeindex)
#r.linsert('currentKeys',1,'T',('TestSuite' + timeindex))
r.publish(redischannel, 'Wonderousthings' + timeindex)
r.setex(
    "MessageIndex" + timeindex + "FormattedDate",
    "From Virtualenv local: " + datey.isoformat() + "T" + timestamp +
    separatorSuffix + format(randt, "000000"), 90)
r.setex("MessageIndex" + timeindex + "ResultDataPayload", "default", 90)
r.setex("MessageIndex" + timeindex + "AuthToken", authtoken, 90)
r.setex("MessageIndex" + timeindex + "Command", testcommand, 90)
r.setex("MessageIndex" + timeindex + "Status", "PENDING", 90)
r.hmset(
    messageindexstorage + messagelistlevel1 + ":" + timeindex, {
        'index': timeindex,
        'TTL': MessageTTL,
Пример #8
0
            #compresst = ravdec.net_compression(img_str)
            #compresst = ravdec.net_compression(img_str)
            #ssuy.writelines(img_str)
            #ssuy.flush()

            #img_str = bytesobj.format("02X")
            #img = qr.make(CurQuery,mfactory=myyfactory)
            #testbase64data = "DEFAULT ERROR"
            testbase64data = img_str
            #testbase64data = base64.b64encode(img_str)
            #buffer = cStringIO.StringIO(yuinn)
            #img.save(buffer, format="JPEG")
            #bihhh = binascii.b2a_base64(yuinn)
            #img_str = base64.b64encode(yuinn)
            #print "%x" % {img[0]} + " " + format(img[1],"00")

            r.setex("MessageIndex" + localuu + "ResultDataPayload",
                    testbase64data, MessageTTL)
            r.setex("MessageIndex" + localuu + "Status", "DATA_DELIVERED",
                    MessageTTL)
            r.sadd(messageindexstorage + ":finishedjobs", localuee)

        r.srem(messageindexstorage + messagelistlevel1, localuee)
        r.delete(messageindexstorage + messagelistlevel1 + ":" + localuu)
        print "Removed : SREM " + messageindexstorage + messagelistlevel1 + " " + '[\"' + localuee + '\"]'
        #print localuu
rtt = r.delete("STOP_HEROKU_WORKER")
time.sleep(5)
print "Worker Terminated with Redis key STOP_HEROKU_WORKER : Count of deleted: " + format(
    rtt, "000")
Пример #9
0
# pylint: disable=E1101, no-absolute-import
"""test checking use of the logging module
"""

__revision__ = ''

import __builtin__

# Muck up the names in an effort to confuse...
import logging as renamed_logging
import os as logging

FORMAT_STR = '{0}, {1}'

# Statements that should be flagged:
renamed_logging.debug('{0}, {1}'.format(4, 5))
renamed_logging.log(renamed_logging.DEBUG, 'msg: {}'.format('Run!'))
renamed_logging.debug(FORMAT_STR.format(4, 5))
renamed_logging.log(renamed_logging.DEBUG, FORMAT_STR.format(4, 5))

# Statements that should not be flagged:
renamed_logging.debug(format(66, 'x'))
renamed_logging.debug(__builtin__.format(66, 'x'))
renamed_logging.log(renamed_logging.DEBUG, 'msg: Run!'.upper())
logging.debug('{0}, {1}'.format(4, 5))
logging.log(logging.DEBUG, 'msg: {}'.format('Run!'))
Пример #10
0
# pylint: disable=E1101, no-absolute-import, import-error,line-too-long, missing-docstring,wrong-import-order,wrong-import-position

try:
    import __builtin__ as builtins
except ImportError:
    import builtins

# Muck up the names in an effort to confuse...
import logging as renamed_logging
import os as logging

FORMAT_STR = "{0}, {1}"

# Statements that should be flagged:
renamed_logging.debug("{0}, {1}".format(4, 5))  # [logging-format-interpolation]
renamed_logging.log(renamed_logging.DEBUG, "msg: {}".format("Run!"))  # [logging-format-interpolation]
renamed_logging.debug(FORMAT_STR.format(4, 5))  # [logging-format-interpolation]
renamed_logging.log(renamed_logging.DEBUG, FORMAT_STR.format(4, 5))  # [logging-format-interpolation]

# Statements that should not be flagged:
renamed_logging.debug(format(66, "x"))
renamed_logging.debug(builtins.format(66, "x"))
renamed_logging.log(renamed_logging.DEBUG, "msg: Run!".upper())
logging.debug("{0}, {1}".format(4, 5))
logging.log(logging.DEBUG, "msg: {}".format("Run!"))