コード例 #1
0
	def registerUser(self, uId, gName, pword):
		if pword not in ['teawithdeeandmarie']:
			with open('pending.txt', 'a') as pendingUsers:
				pendingUsers.write(''' %s : %s ''' % (uId, gName))
			return False
		newrec = {}
		newrec["I"] = uId
		newrec["P"] = utils.scramble(pword, 7)
		newrec["N"] = utils.scramble(gName, 7)
		self.users.append(newrec)
		self.saveUserList()
		return True
コード例 #2
0
	def __init__(self):
		'''
		file will have I, N, and P
		object will unscramble to id, name, and pword
		'''
		with open("userList.json") as uData:
			self.users = json.load(uData)
		for u in self.users:
			u["name"] = utils.scramble(u["N"][:], -7)
			u["pword"] = utils.scramble(u["P"][:], -7)
			gnum = ''
			for n in u["I"]:
				gnum += str(string.ascii_lowercase[:].find(n))
			u["id"] = gnum
コード例 #3
0
    def set_signal_array(self):
        """
		Set the array of random signals for entropy estimation.
		"""

        self.set_sparse_signals()
        self.Ss = sp.tile(self.Ss, reps=(self.num_signals, 1))
        self.Ss = scramble(self.Ss).T
コード例 #4
0
	def isRegisteredUser(self, uId):
		'''
		scrambles uId and then checks for it
		'''
		i = utils.scramble(uId[:], 7)
		print('''
		in isRegisteredUser, uId coming in is %s, looking for %s
		''' % uId, i)
		for u in self.users:
			if i == u["I"]:
				return True
		return False
コード例 #5
0
    def set_ordered_dual_signal_array(self):
        """
		Set the array of random signals for entropy estimation. This 
		will organize the signals in blocks, where outer loop is 
		the foreground signal and inner loop is the background
		"""

        # Set individual foreground signals
        self.seed_Kk_1 = 0
        tmp_Kk_1 = self.Kk_1
        self.Kk_1 = 0
        self.set_sparse_signals()
        self.Ss = sp.tile(self.Ss, reps=(self.num_fore_signals, 1))
        sp.random.seed(self.seed_dSs_1)
        self.Ss_fore = scramble(self.Ss).T
        self.Kk_1 = tmp_Kk_1

        # Set individual background signals
        tmp_Kk_2 = self.Kk_2
        self.Kk_2 = 0
        self.set_sparse_signals()
        self.Ss = sp.tile(self.Ss, reps=(self.num_back_signals, 1))
        sp.random.seed(self.seed_dSs_2)
        self.Ss_back = scramble(self.Ss).T
        self.Kk_2 = tmp_Kk_2

        # Tile such that outer loop is foreground; inner is background
        self.Ss = sp.zeros(
            (self.Nn, self.num_back_signals * self.num_fore_signals))
        for iS in range(self.num_fore_signals):
            idx_beg = self.num_back_signals * iS
            idx_end = idx_beg + self.num_back_signals
            self.Ss[:, idx_beg:idx_end] = (self.Ss_fore[:, iS].T +
                                           self.Ss_back.T).T

        # Get range of concentrations; foreground and background scaled same
        self.Ss *= 10.**sp.random.uniform(self.entropy_conc_min,
                                          self.entropy_conc_max,
                                          self.Ss.shape[1])
コード例 #6
0
ファイル: tmList.py プロジェクト: tomargames/tomarPython
#!/Users/tomar/Anaconda3/python.exe
"""
Created on Mon Dec 26 14:28:31 2016

@author: tomar
"""
import utils
import json

with open("tmList.json") as uData:
    tmUsers = json.load(uData)
for u in tmUsers.keys():
    print(utils.scramble(tmUsers[u], 12))
コード例 #7
0
ファイル: testing.py プロジェクト: tomargames/tomarPython
#!/Users/tomar/Anaconda3/python.exe
"""
Created on Fri Jan 20 17:47:12 2017
#!/usr/bin/python
#!/Users/tomar/Anaconda3/python.exe
"""
import sys
import json
try:
    import utils
except:
    sys.path.append("..")
    import utils

print("Content-type: text/html \n")
#record = {}
#record["id"] = "217043487053246691286"
with open("eqs.json") as qData:
    questions = json.load(qData)
#for q in questions:
#    record[q["K"]] = "1"
#print(record)
#counters = {}
for q in questions:
    for s in range(2):
        ev = q["S"][s]["E"]  # enneagram value of that statement
        if ev in ('1', '3'):
            print('%s %s %s %s' %
                  (q['K'], q['D'], ev, utils.scramble(q['S'][s]['S'], -9)))
コード例 #8
0
ファイル: index.py プロジェクト: tomargames/tomarPython
                    fString += '<td class="textL"><b>' + c[
                        0] + '</b>: ' + utils.formatNumber(c[1], 3) + '</td>'
                fString += '</tr>'
                print(fString)
    else:
        saverecord = {}
    print('</table></td></tr></table>')
    print('''
	<script>
	function validateForm()
	{
	''')
    for q in eData.questions:
        k = "You missed answering question " + q[
            "D"] + ":\\n\\n" + utils.scramble(
                q["S"][0]["S"], -9
            ) + ".\\n or \\n" + utils.scramble(
                q["S"][1]["S"], -9
            ) + ".\\n\\nOK to proceed without it, or Cancel to take another look. "
        print('if (document.getElementById("' + q["K"] +
              '0").checked == false && document.getElementById("' + q["K"] +
              '1").checked == false) ')
        print('{ document.getElementById("' + q["K"] +
              '0").focus(); if (confirm("' + k + '") != true) 	{ return; } }')
    print('''
		saveProgress();
		document.tm9Form.submit();
	}
	function saveProgress()
	{
		var formElement = document.querySelector("saveForm");