Files
pynkode/nkode_demo.ipynb

122 lines
2.5 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"outputs": [],
"source": [
"from nkode_api import NKodeAPI\n",
"from src.models import NKodePolicy"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-17T13:17:41.756601Z",
"start_time": "2024-07-17T13:17:41.702924Z"
}
}
},
{
"cell_type": "code",
"execution_count": 2,
"outputs": [],
"source": [
"api = NKodeAPI()"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-17T13:17:41.759087Z",
"start_time": "2024-07-17T13:17:41.756977Z"
}
}
},
{
"cell_type": "code",
"execution_count": 3,
"outputs": [],
"source": [
"policy = NKodePolicy(\n",
" max_nkode_len=10,\n",
" min_nkode_len=4,\n",
" distinct_sets=0,\n",
" distinct_attributes=4\n",
")\n",
"numb_of_keys = 10\n",
"attrs_per_key = 7 # aka number of sets\n",
"customer_id = api.create_new_customer(numb_of_keys, attrs_per_key, policy)"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-17T13:17:41.886328Z",
"start_time": "2024-07-17T13:17:41.760420Z"
}
}
},
{
"cell_type": "code",
"execution_count": 4,
"outputs": [],
"source": [
"customer = api.customers[customer_id]\n",
"customer.interface.customer_interface"
],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-17T13:17:41.888107Z",
"start_time": "2024-07-17T13:17:41.886565Z"
}
}
},
{
"cell_type": "code",
"execution_count": 4,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-17T13:17:41.891074Z",
"start_time": "2024-07-17T13:17:41.889383Z"
}
}
},
{
"cell_type": "code",
"execution_count": 4,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"end_time": "2024-07-17T13:17:41.892614Z",
"start_time": "2024-07-17T13:17:41.891400Z"
}
}
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
}
},
"nbformat": 4,
"nbformat_minor": 0
}