You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

326 lines
7.1 KiB
Plaintext

{
"cells": [
{
"cell_type": "code",
"execution_count": 24,
"id": "4da64377",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1mreformatted server.py\u001b[0m\r\n",
"\u001b[1mAll done! ✨ 🍰 ✨\u001b[0m\r\n",
"\u001b[1m1 file reformatted\u001b[0m.\r\n"
]
}
],
"source": [
"! black -l 79 server.py"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "22c4a892",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0m"
]
}
],
"source": [
"! isort server.py"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "2131e0fe",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"************* Module server\n",
"server.py:18:8: W0201: Attribute 'transport' defined outside __init__ (attribute-defined-outside-init)\n",
"\n",
"------------------------------------------------------------------\n",
"Your code has been rated at 9.80/10 (previous run: 9.79/10, +0.01)\n",
"\n",
"\u001b[0m"
]
}
],
"source": [
"! pylint server.py"
]
},
{
"cell_type": "markdown",
"id": "d801e0c9",
"metadata": {},
"source": [
"___"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "1378d92e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1mAll done! ✨ 🍰 ✨\u001b[0m\r\n",
"1 file left unchanged.\r\n"
]
}
],
"source": [
"! black -l 79 test.py"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "ad4f204e",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Fixing /home/mikhaylovaf/projects/python/6. Финальный проект/1. Финальный проект/test.py\r\n",
"\u001b[0m"
]
}
],
"source": [
"! isort test.py"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "3b7f2d6a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"************* Module test\n",
"test.py:7:71: C0303: Trailing whitespace (trailing-whitespace)\n",
"test.py:60:0: C0301: Line too long (112/100) (line-too-long)\n",
"test.py:74:0: C0301: Line too long (113/100) (line-too-long)\n",
"test.py:86:0: C0301: Line too long (128/100) (line-too-long)\n",
"test.py:17:0: C0116: Missing function or method docstring (missing-function-docstring)\n",
"test.py:47:11: W0703: Catching too general exception Exception (broad-except)\n",
"test.py:64:11: W0703: Catching too general exception Exception (broad-except)\n",
"test.py:78:11: W0703: Catching too general exception Exception (broad-except)\n",
"test.py:90:11: W0703: Catching too general exception Exception (broad-except)\n",
"test.py:84:11: C1803: 'result != {}' can be simplified to 'result' as an empty sequence is falsey (use-implicit-booleaness-not-comparison)\n",
"test.py:17:0: R0915: Too many statements (52/50) (too-many-statements)\n",
"\n",
"------------------------------------------------------------------\n",
"Your code has been rated at 7.96/10 (previous run: 4.11/10, +3.86)\n",
"\n",
"\u001b[0m"
]
}
],
"source": [
"! pylint test.py"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "af6c56ab",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Похоже, что все верно!\r\n"
]
}
],
"source": [
"! python test.py"
]
},
{
"cell_type": "markdown",
"id": "553480a3",
"metadata": {},
"source": [
"---"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "29ac8524",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[1mreformatted client.py\u001b[0m\r\n",
"\u001b[1mAll done! ✨ 🍰 ✨\u001b[0m\r\n",
"\u001b[1m1 file reformatted\u001b[0m.\r\n"
]
}
],
"source": [
"! black -l 79 client.py"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "ce72925b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[0m"
]
}
],
"source": [
"! isort client.py"
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "c24170d2",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r\n",
"--------------------------------------------------------------------\r\n",
"Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)\r\n",
"\r\n",
"\u001b[0m"
]
}
],
"source": [
"! pylint client.py"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "994d9338",
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
".....\r\n",
"----------------------------------------------------------------------\r\n",
"Ran 5 tests in 0.001s\r\n",
"\r\n",
"OK\r\n"
]
}
],
"source": [
"! python -m unittest test_client.py"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "31cfddc7",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'huginn.cpu': [(1642667947, 0.5), (1642667948, 2.0), (1642667948, 0.5)], 'muninn.cpu': [(1642667950, 3.0), (1642667951, 4.0)], 'muninn.memory': [(1642751508, 4200000.0)]}\n"
]
}
],
"source": [
"from client import Client\n",
"\n",
"client = Client(\"127.0.0.1\", 8888, timeout=15)\n",
"\n",
"client.put(\"huginn.cpu\", 0.5, timestamp=1642667947)\n",
"client.put(\"huginn.cpu\", 2.0, timestamp=1642667948)\n",
"client.put(\"huginn.cpu\", 0.5, timestamp=1642667948)\n",
"\n",
"client.put(\"muninn.cpu\", 3, timestamp=1642667950)\n",
"client.put(\"muninn.cpu\", 4, timestamp=1642667951)\n",
"client.put(\"muninn.memory\", 4200000)\n",
"\n",
"print(client.get(\"*\"))"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "14aac259",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{}\n"
]
}
],
"source": [
"print(client.get(\"non_existing_key\"))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 5
}