refactor customer interface to attributes
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 11,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from nkode_api import NKodeAPI\n",
|
||||
@@ -14,14 +14,14 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.636706Z",
|
||||
"start_time": "2024-07-19T15:38:32.541836Z"
|
||||
"end_time": "2024-07-19T19:42:26.168590Z",
|
||||
"start_time": "2024-07-19T19:42:26.080917Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 12,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def random_username() -> str:\n",
|
||||
@@ -40,14 +40,14 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.636920Z",
|
||||
"start_time": "2024-07-19T15:38:32.606667Z"
|
||||
"end_time": "2024-07-19T19:42:26.169484Z",
|
||||
"start_time": "2024-07-19T19:42:26.084626Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 13,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"api = NKodeAPI()"
|
||||
@@ -55,8 +55,8 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.636991Z",
|
||||
"start_time": "2024-07-19T15:38:32.608558Z"
|
||||
"end_time": "2024-07-19T19:42:26.169561Z",
|
||||
"start_time": "2024-07-19T19:42:26.087253Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -79,7 +79,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 14,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"policy = NKodePolicy(\n",
|
||||
@@ -98,8 +98,8 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.817740Z",
|
||||
"start_time": "2024-07-19T15:38:32.612174Z"
|
||||
"end_time": "2024-07-19T19:42:26.266945Z",
|
||||
"start_time": "2024-07-19T19:42:26.091559Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -126,28 +126,28 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 16,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Customer Sets: [63949, 41634, 17125, 52762, 13459, 5935, 727]\n",
|
||||
"Customer Attributes: [52222, 57050, 17039, 29896, 31069, 35859, 36843, 2137, 24380, 34643, 29053, 46327, 39534, 64877, 53617, 14001, 39532, 19103, 38549, 42982, 63429, 11337, 42520, 23186, 49849, 6237, 49291, 44219, 34592, 26781, 25410, 34134, 51292, 40084, 49002, 1221, 30724, 62975, 33074, 22158, 18970, 54242, 15906, 19581, 10796, 6147, 36402, 44152, 43216, 16186, 571, 32657, 20955, 10260, 51931, 46321, 40259, 1905, 14430, 48389, 35797, 48564, 32173, 50142, 65402, 11082, 39195, 46929, 18113, 52721]\n"
|
||||
"Customer Sets: [36939, 30293, 19380, 1964, 37282, 10031, 35065]\n",
|
||||
"Customer Attributes: [3505, 54543, 45347, 44748, 53903, 52815, 60524, 9975, 48764, 34550, 64903, 32542, 23911, 35423, 63534, 65510, 21500, 37871, 19901, 6884, 255, 17031, 63424, 28925, 34144, 42192, 31390, 40124, 17254, 48729, 39518, 57631, 43182, 61064, 4422, 53465, 55843, 37538, 60243, 21929, 51240, 24244, 27507, 57663, 45226, 31543, 58101, 37770, 62668, 49947, 64348, 20373, 64786, 14379, 13970, 11323, 3662, 62709, 37802, 27817, 60687, 22963, 42846, 3620, 9784, 48482, 13855, 60342, 34564, 45989]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"set_vals = customer.interface.set_vals\n",
|
||||
"attr_vals = customer.interface.attr_vals\n",
|
||||
"set_vals = customer.attributes.set_vals\n",
|
||||
"attr_vals = customer.attributes.attr_vals\n",
|
||||
"print(f\"Customer Sets: {set_vals}\")\n",
|
||||
"print(f\"Customer Attributes: {attr_vals}\")"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.818026Z",
|
||||
"start_time": "2024-07-19T15:38:32.781094Z"
|
||||
"end_time": "2024-07-19T19:42:43.930527Z",
|
||||
"start_time": "2024-07-19T19:42:43.924673Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -162,20 +162,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 17,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Set to Attribute Map:\n",
|
||||
"63949: [52222, 2137, 53617, 11337, 34592, 1221, 15906, 16186, 40259, 50142]\n",
|
||||
"41634: [57050, 24380, 14001, 42520, 26781, 30724, 19581, 571, 1905, 65402]\n",
|
||||
"17125: [17039, 34643, 39532, 23186, 25410, 62975, 10796, 32657, 14430, 11082]\n",
|
||||
"52762: [29896, 29053, 19103, 49849, 34134, 33074, 6147, 20955, 48389, 39195]\n",
|
||||
"13459: [31069, 46327, 38549, 6237, 51292, 22158, 36402, 10260, 35797, 46929]\n",
|
||||
"5935: [35859, 39534, 42982, 49291, 40084, 18970, 44152, 51931, 48564, 18113]\n",
|
||||
"727: [36843, 64877, 63429, 44219, 49002, 54242, 43216, 46321, 32173, 52721]\n"
|
||||
"36939: [3505, 9975, 63534, 17031, 17254, 53465, 27507, 49947, 3662, 3620]\n",
|
||||
"30293: [54543, 48764, 65510, 63424, 48729, 55843, 57663, 64348, 62709, 9784]\n",
|
||||
"19380: [45347, 34550, 21500, 28925, 39518, 37538, 45226, 20373, 37802, 48482]\n",
|
||||
"1964: [44748, 64903, 37871, 34144, 57631, 60243, 31543, 64786, 27817, 13855]\n",
|
||||
"37282: [53903, 32542, 19901, 42192, 43182, 21929, 58101, 14379, 60687, 60342]\n",
|
||||
"10031: [52815, 23911, 6884, 31390, 61064, 51240, 37770, 13970, 22963, 34564]\n",
|
||||
"35065: [60524, 35423, 255, 40124, 4422, 24244, 62668, 11323, 42846, 45989]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -190,8 +190,8 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.818150Z",
|
||||
"start_time": "2024-07-19T15:38:32.784103Z"
|
||||
"end_time": "2024-07-19T19:42:46.177582Z",
|
||||
"start_time": "2024-07-19T19:42:46.173094Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -215,7 +215,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 18,
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"session_id, signup_interface = api.generate_index_interface(customer_id)"
|
||||
@@ -223,8 +223,8 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.818223Z",
|
||||
"start_time": "2024-07-19T15:38:32.787316Z"
|
||||
"end_time": "2024-07-19T19:42:47.644598Z",
|
||||
"start_time": "2024-07-19T19:42:47.640134Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -240,25 +240,25 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 19,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Keypad View\n",
|
||||
"Key 0: [14, 50, 16, 59, 39, 26, 6]\n",
|
||||
"Key 1: [56, 36, 37, 52, 18, 47, 41]\n",
|
||||
"Key 2: [49, 43, 2, 66, 60, 54, 69]\n",
|
||||
"Key 3: [7, 8, 44, 3, 11, 68, 13]\n",
|
||||
"Key 4: [63, 57, 65, 45, 53, 12, 48]\n",
|
||||
"Key 5: [0, 22, 23, 10, 4, 40, 20]\n",
|
||||
"Key 6: [35, 15, 51, 31, 67, 5, 55]\n",
|
||||
"Key 7: [42, 29, 9, 38, 32, 33, 62]\n",
|
||||
"Key 8: [21, 1, 58, 24, 46, 19, 34]\n",
|
||||
"Key 9: [28, 64, 30, 17, 25, 61, 27]\n",
|
||||
"Key 0: [63, 1, 16, 59, 32, 19, 34]\n",
|
||||
"Key 1: [49, 57, 65, 66, 4, 47, 48]\n",
|
||||
"Key 2: [28, 50, 58, 10, 11, 5, 27]\n",
|
||||
"Key 3: [21, 43, 51, 52, 25, 68, 41]\n",
|
||||
"Key 4: [7, 64, 2, 38, 60, 54, 62]\n",
|
||||
"Key 5: [56, 29, 23, 31, 67, 61, 20]\n",
|
||||
"Key 6: [42, 15, 9, 24, 53, 26, 13]\n",
|
||||
"Key 7: [14, 36, 30, 45, 46, 33, 69]\n",
|
||||
"Key 8: [0, 22, 44, 17, 39, 40, 55]\n",
|
||||
"Key 9: [35, 8, 37, 3, 18, 12, 6]\n",
|
||||
"Selected Keys\n",
|
||||
"[4, 2, 1, 9]\n"
|
||||
"[9, 4, 3, 2]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -272,32 +272,32 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.818320Z",
|
||||
"start_time": "2024-07-19T15:38:32.791137Z"
|
||||
"end_time": "2024-07-19T19:42:48.948115Z",
|
||||
"start_time": "2024-07-19T19:42:48.942682Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 20,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Keypad View\n",
|
||||
"Key 0: [7, 29, 51, 66, 53, 47, 27]\n",
|
||||
"Key 1: [21, 15, 2, 59, 18, 33, 20]\n",
|
||||
"Key 2: [63, 43, 16, 17, 32, 5, 13]\n",
|
||||
"Key 3: [56, 50, 30, 10, 67, 54, 34]\n",
|
||||
"Key 4: [42, 64, 23, 3, 60, 26, 48]\n",
|
||||
"Key 5: [35, 22, 44, 24, 39, 61, 41]\n",
|
||||
"Key 6: [49, 8, 58, 45, 25, 40, 62]\n",
|
||||
"Key 7: [14, 1, 65, 52, 4, 68, 55]\n",
|
||||
"Key 8: [28, 57, 37, 38, 11, 19, 69]\n",
|
||||
"Key 9: [0, 36, 9, 31, 46, 12, 6]\n",
|
||||
"Key 0: [49, 22, 23, 59, 11, 12, 62]\n",
|
||||
"Key 1: [42, 64, 44, 52, 46, 5, 6]\n",
|
||||
"Key 2: [56, 8, 2, 66, 32, 33, 27]\n",
|
||||
"Key 3: [0, 50, 37, 24, 25, 19, 69]\n",
|
||||
"Key 4: [7, 36, 58, 31, 4, 68, 34]\n",
|
||||
"Key 5: [35, 1, 30, 17, 53, 47, 41]\n",
|
||||
"Key 6: [28, 43, 16, 38, 67, 26, 48]\n",
|
||||
"Key 7: [14, 57, 51, 3, 39, 61, 13]\n",
|
||||
"Key 8: [63, 15, 65, 10, 60, 40, 20]\n",
|
||||
"Key 9: [21, 29, 9, 45, 18, 54, 55]\n",
|
||||
"Selected Keys\n",
|
||||
"[9, 1, 7, 8]\n"
|
||||
"[0, 2, 1, 6]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -310,8 +310,8 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.818413Z",
|
||||
"start_time": "2024-07-19T15:38:32.794201Z"
|
||||
"end_time": "2024-07-19T19:42:49.532737Z",
|
||||
"start_time": "2024-07-19T19:42:49.528687Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -329,7 +329,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 21,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -337,16 +337,16 @@
|
||||
"text": [
|
||||
"Set Interface\n",
|
||||
"Keypad View\n",
|
||||
"Key 0: [14, 50, 16, 59, 39, 26, 6]\n",
|
||||
"Key 1: [56, 36, 37, 52, 18, 47, 41]\n",
|
||||
"Key 2: [49, 43, 2, 66, 60, 54, 69]\n",
|
||||
"Key 3: [7, 8, 44, 3, 11, 68, 13]\n",
|
||||
"Key 4: [63, 57, 65, 45, 53, 12, 48]\n",
|
||||
"Key 5: [0, 22, 23, 10, 4, 40, 20]\n",
|
||||
"Key 6: [35, 15, 51, 31, 67, 5, 55]\n",
|
||||
"Key 7: [42, 29, 9, 38, 32, 33, 62]\n",
|
||||
"Key 8: [21, 1, 58, 24, 46, 19, 34]\n",
|
||||
"Key 9: [28, 64, 30, 17, 25, 61, 27]\n"
|
||||
"Key 0: [63, 1, 16, 59, 32, 19, 34]\n",
|
||||
"Key 1: [49, 57, 65, 66, 4, 47, 48]\n",
|
||||
"Key 2: [28, 50, 58, 10, 11, 5, 27]\n",
|
||||
"Key 3: [21, 43, 51, 52, 25, 68, 41]\n",
|
||||
"Key 4: [7, 64, 2, 38, 60, 54, 62]\n",
|
||||
"Key 5: [56, 29, 23, 31, 67, 61, 20]\n",
|
||||
"Key 6: [42, 15, 9, 24, 53, 26, 13]\n",
|
||||
"Key 7: [14, 36, 30, 45, 46, 33, 69]\n",
|
||||
"Key 8: [0, 22, 44, 17, 39, 40, 55]\n",
|
||||
"Key 9: [35, 8, 37, 3, 18, 12, 6]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -357,14 +357,14 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.818504Z",
|
||||
"start_time": "2024-07-19T15:38:32.797246Z"
|
||||
"end_time": "2024-07-19T19:42:50.432534Z",
|
||||
"start_time": "2024-07-19T19:42:50.427816Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 22,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -372,16 +372,16 @@
|
||||
"text": [
|
||||
"Confirm Interface\n",
|
||||
"Keypad View\n",
|
||||
"Key 0: [7, 29, 51, 66, 53, 47, 27]\n",
|
||||
"Key 1: [21, 15, 2, 59, 18, 33, 20]\n",
|
||||
"Key 2: [63, 43, 16, 17, 32, 5, 13]\n",
|
||||
"Key 3: [56, 50, 30, 10, 67, 54, 34]\n",
|
||||
"Key 4: [42, 64, 23, 3, 60, 26, 48]\n",
|
||||
"Key 5: [35, 22, 44, 24, 39, 61, 41]\n",
|
||||
"Key 6: [49, 8, 58, 45, 25, 40, 62]\n",
|
||||
"Key 7: [14, 1, 65, 52, 4, 68, 55]\n",
|
||||
"Key 8: [28, 57, 37, 38, 11, 19, 69]\n",
|
||||
"Key 9: [0, 36, 9, 31, 46, 12, 6]\n"
|
||||
"Key 0: [49, 22, 23, 59, 11, 12, 62]\n",
|
||||
"Key 1: [42, 64, 44, 52, 46, 5, 6]\n",
|
||||
"Key 2: [56, 8, 2, 66, 32, 33, 27]\n",
|
||||
"Key 3: [0, 50, 37, 24, 25, 19, 69]\n",
|
||||
"Key 4: [7, 36, 58, 31, 4, 68, 34]\n",
|
||||
"Key 5: [35, 1, 30, 17, 53, 47, 41]\n",
|
||||
"Key 6: [28, 43, 16, 38, 67, 26, 48]\n",
|
||||
"Key 7: [14, 57, 51, 3, 39, 61, 13]\n",
|
||||
"Key 8: [63, 15, 65, 10, 60, 40, 20]\n",
|
||||
"Key 9: [21, 29, 9, 45, 18, 54, 55]\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -392,14 +392,14 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:32.818596Z",
|
||||
"start_time": "2024-07-19T15:38:32.799553Z"
|
||||
"end_time": "2024-07-19T19:42:50.897855Z",
|
||||
"start_time": "2024-07-19T19:42:50.894734Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 23,
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
@@ -420,8 +420,8 @@
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:33.435016Z",
|
||||
"start_time": "2024-07-19T15:38:32.803552Z"
|
||||
"end_time": "2024-07-19T19:42:51.884002Z",
|
||||
"start_time": "2024-07-19T19:42:51.198018Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -438,14 +438,14 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 23,
|
||||
"outputs": [],
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:33.451250Z",
|
||||
"start_time": "2024-07-19T15:38:33.435255Z"
|
||||
"end_time": "2024-07-19T19:42:53.411190Z",
|
||||
"start_time": "2024-07-19T19:42:53.406912Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -460,16 +460,130 @@
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"## Dispersion"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 24,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<IPython.core.display.Markdown object>",
|
||||
"text/markdown": "|key|set0|set1|set2|set3|\n|-|-|-|-|-|\n|key1|1|10|11|100|\n|key2|2|20|22|200|\n|key3|3|30|33|300|\n|key4|4|40|44|400|\n|key5|5|50|55|500|"
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"from src.utils import secure_fisher_yates_shuffle, matrix_to_list\n",
|
||||
"from src.user_interface import UserInterface\n",
|
||||
"from IPython.display import Markdown, display\n",
|
||||
"\n",
|
||||
"def keypad_md_table(interface: list[int], keypad_size: KeypadSize) -> str:\n",
|
||||
" assert (keypad_size.numb_of_attrs == len(interface))\n",
|
||||
" interface_keypad = list_to_matrix(interface, keypad_size.attrs_per_key)\n",
|
||||
" table = \"|key|\" + \"\".join([f\"set{idx}|\" for idx in range(keypad_size.attrs_per_key)])\n",
|
||||
" table += \"\\n|\" + \"\".join(\"-|\" for _ in range(keypad_size.attrs_per_key+1))\n",
|
||||
"\n",
|
||||
" for key in range(keypad_size.numb_of_keys):\n",
|
||||
" table += f\"\\n|key{key+1}|\"\n",
|
||||
" table += \"|\".join([str(attr) for attr in interface_keypad[key]])\n",
|
||||
" table += \"|\"\n",
|
||||
" return table\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"keypad_size = KeypadSize(numb_of_keys=5, attrs_per_key=4)\n",
|
||||
"attrs = [1, 10, 11, 100]\n",
|
||||
"interface = []\n",
|
||||
"for key_numb in range(1,keypad_size.numb_of_keys+1):\n",
|
||||
" interface.extend([key_numb*attr for attr in attrs])\n",
|
||||
"\n",
|
||||
"demo_interface = UserInterface(keypad_size=keypad_size, interface=interface)\n",
|
||||
"\n",
|
||||
"display(Markdown(keypad_md_table(demo_interface.interface, keypad_size)))"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T19:42:55.684088Z",
|
||||
"start_time": "2024-07-19T19:42:55.680817Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 25,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<IPython.core.display.Markdown object>",
|
||||
"text/markdown": "|key|set0|set1|set2|set3|\n|-|-|-|-|-|\n|key1|5|50|55|500|\n|key2|3|30|33|300|\n|key3|2|20|22|200|\n|key4|4|40|44|400|\n|key5|1|10|11|100|"
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"demo_interface_matrix = list_to_matrix(demo_interface.interface, demo_interface.keypad_size.attrs_per_key)\n",
|
||||
"shuffled_keys = secure_fisher_yates_shuffle(demo_interface_matrix)\n",
|
||||
"shuffled_keys_list = matrix_to_list(shuffled_keys)\n",
|
||||
"display(Markdown(keypad_md_table(shuffled_keys_list, keypad_size)))\n"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T19:42:56.543819Z",
|
||||
"start_time": "2024-07-19T19:42:56.537207Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 26,
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": "<IPython.core.display.Markdown object>",
|
||||
"text/markdown": "|key|set0|set1|set2|set3|\n|-|-|-|-|-|\n|key1|3|40|11|200|\n|key2|2|10|55|400|\n|key3|4|50|33|100|\n|key4|1|30|22|500|\n|key5|5|20|44|300|"
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"attr_rotation = secure_fisher_yates_shuffle(list(range(keypad_size.numb_of_keys)))[:keypad_size.attrs_per_key]\n",
|
||||
"dispersed_interface = UserInterface.random_attribute_rotation(\n",
|
||||
" shuffled_keys,\n",
|
||||
" attr_rotation\n",
|
||||
")\n",
|
||||
"\n",
|
||||
"display(Markdown(keypad_md_table(matrix_to_list(dispersed_interface), keypad_size)))"
|
||||
],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T19:42:56.940543Z",
|
||||
"start_time": "2024-07-19T19:42:56.935742Z"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"outputs": [],
|
||||
"source": [],
|
||||
"metadata": {
|
||||
"collapsed": false,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2024-07-19T15:38:33.451441Z",
|
||||
"start_time": "2024-07-19T15:38:33.438804Z"
|
||||
"start_time": "2024-07-19T19:42:26.284802Z"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user