Repository: RPing/influx-prompt

Issue:
Upgrading to prompt_toolkit 2.0/3.0
`Prompt_toolkit 2.0 is not compatible with 1.0.`
https://python-prompt-toolkit.readthedocs.io/en/master/pages/upgrading/2.0.html
https://python-prompt-toolkit.readthedocs.io/en/master/pages/upgrading/3.0.html

Discussion:

Patch:
diff --git a/.travis.yml b/.travis.yml
index 2b05bc0..b6c62c6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,8 +6,6 @@ services:
 language: python
 
 python:
-  - "2.7"
-  - "3.5"
   - "3.6"
   - "3.7"
   - "3.8"
diff --git a/Pipfile b/Pipfile
index 70305bb..6d896e1 100644
--- a/Pipfile
+++ b/Pipfile
@@ -6,15 +6,15 @@ verify_ssl = true
 [dev-packages]
 pytest = "*"
 influx-prompt = {path = ".", editable = true}
-mock = "*"
 pytest-cov = "*"
+flake8 = "*"
 
 [packages]
 requests = "*"
-pygments = "*"
-prompt-toolkit = "<2.0.0"
+prompt-toolkit = "~=3.0"
 jsane = "*"
 fuzzyfinder = "*"
+pygments = "*"
 
 [requires]
 python_version = "3.6"
diff --git a/Pipfile.lock b/Pipfile.lock
index ff3a1cd..e2c964a 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -1,7 +1,7 @@
 {
     "_meta": {
         "hash": {
-            "sha256": "ae25851c2ccb94cf7d82abfe7d770cdb2df84d065206fb6784323970bdfc971c"
+            "sha256": "d442e0dcd928384c0730820c3dec02784ea156b0c7f40c66df5e7b6d32214777"
         },
         "pipfile-spec": 6,
         "requires": {
@@ -16,14 +16,6 @@
         ]
     },
     "default": {
-        "backports.functools-lru-cache": {
-            "hashes": [
-                "sha256:0bada4c2f8a43d533e4ecb7a12214d9420e66eb206d54bf2d682581ca4b80848",
-                "sha256:8fde5f188da2d593bd5bc0be98d9abc46c95bb8a9dde93429570192ee6cc2d4a"
-            ],
-            "markers": "python_version < '3.2'",
-            "version": "==1.6.1"
-        },
         "certifi": {
             "hashes": [
                 "sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3",
@@ -64,20 +56,19 @@
         },
         "prompt-toolkit": {
             "hashes": [
-                "sha256:37925b37a4af1f6448c76b7606e0285f79f434ad246dda007a27411cca730c6d",
-                "sha256:dd4fca02c8069497ad931a2d09914c6b0d1b50151ce876bc15bde4c747090126",
-                "sha256:f7eec66105baf40eda9ab026cd8b2e251337eea8d111196695d82e0c5f0af852"
+                "sha256:822f4605f28f7d2ba6b0b09a31e25e140871e96364d1d377667b547bb3bf4489",
+                "sha256:83074ee28ad4ba6af190593d4d4c607ff525272a504eb159199b6dd9f950c950"
             ],
             "index": "pypi",
-            "version": "==1.0.18"
+            "version": "==3.0.7"
         },
         "pygments": {
             "hashes": [
-                "sha256:2a3fe295e54a20164a9df49c75fa58526d3be48e14aceba6d6b1e8ac0bfd6f1b",
-                "sha256:98c8aa5a9f778fcd1026a17361ddaf7330d1b7c62ae97c3bb0ae73e0b9b6b0fe"
+                "sha256:307543fe65c0947b126e83dd5a61bd8acbd84abec11f43caebaf5534cbc17998",
+                "sha256:926c3f319eda178d1bd90851e4317e6d8cdb5e292a3386aac9bd75eca29cf9c7"
             ],
             "index": "pypi",
-            "version": "==2.5.2"
+            "version": "==2.7.1"
         },
         "requests": {
             "hashes": [
@@ -87,14 +78,6 @@
             "index": "pypi",
             "version": "==2.24.0"
         },
-        "six": {
-            "hashes": [
-                "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
-                "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"
-            ],
-            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
-            "version": "==1.15.0"
-        },
         "urllib3": {
             "hashes": [
                 "sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a",
@@ -112,29 +95,13 @@
         }
     },
     "develop": {
-        "atomicwrites": {
-            "hashes": [
-                "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197",
-                "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"
-            ],
-            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
-            "version": "==1.4.0"
-        },
         "attrs": {
             "hashes": [
-                "sha256:08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
-                "sha256:f7b7ce16570fe9965acd6d30101a28f62fb4a7f9e926b3bbc9b61f8b04247e72"
+                "sha256:26b54ddbbb9ee1d34d5d3668dd37d6cf74990ab23c828c2888dccdceee395594",
+                "sha256:fce7fc47dfc976152e82d53ff92fa0407700c21acd20886a13777a0d20e655dc"
             ],
             "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
-            "version": "==19.3.0"
-        },
-        "backports.functools-lru-cache": {
-            "hashes": [
-                "sha256:0bada4c2f8a43d533e4ecb7a12214d9420e66eb206d54bf2d682581ca4b80848",
-                "sha256:8fde5f188da2d593bd5bc0be98d9abc46c95bb8a9dde93429570192ee6cc2d4a"
-            ],
-            "markers": "python_version < '3.2'",
-            "version": "==1.6.1"
+            "version": "==20.2.0"
         },
         "certifi": {
             "hashes": [
@@ -150,69 +117,53 @@
             ],
             "version": "==3.0.4"
         },
-        "configparser": {
-            "hashes": [
-                "sha256:254c1d9c79f60c45dfde850850883d5aaa7f19a23f13561243a050d5a7c3fe4c",
-                "sha256:c7d282687a5308319bf3d2e7706e575c635b0a470342641c93bea0ea3b5331df"
-            ],
-            "markers": "python_version < '3'",
-            "version": "==4.0.2"
-        },
-        "contextlib2": {
-            "hashes": [
-                "sha256:01f490098c18b19d2bd5bb5dc445b2054d2fa97f09a4280ba2c5f3c394c8162e",
-                "sha256:3355078a159fbb44ee60ea80abd0d87b80b78c248643b49aa6d94673b413609b"
-            ],
-            "markers": "python_version < '3'",
-            "version": "==0.6.0.post1"
-        },
         "coverage": {
             "hashes": [
-                "sha256:098a703d913be6fbd146a8c50cc76513d726b022d170e5e98dc56d958fd592fb",
-                "sha256:16042dc7f8e632e0dcd5206a5095ebd18cb1d005f4c89694f7f8aafd96dd43a3",
-                "sha256:1adb6be0dcef0cf9434619d3b892772fdb48e793300f9d762e480e043bd8e716",
-                "sha256:27ca5a2bc04d68f0776f2cdcb8bbd508bbe430a7bf9c02315cd05fb1d86d0034",
-                "sha256:28f42dc5172ebdc32622a2c3f7ead1b836cdbf253569ae5673f499e35db0bac3",
-                "sha256:2fcc8b58953d74d199a1a4d633df8146f0ac36c4e720b4a1997e9b6327af43a8",
-                "sha256:304fbe451698373dc6653772c72c5d5e883a4aadaf20343592a7abb2e643dae0",
-                "sha256:30bc103587e0d3df9e52cd9da1dd915265a22fad0b72afe54daf840c984b564f",
-                "sha256:40f70f81be4d34f8d491e55936904db5c527b0711b2a46513641a5729783c2e4",
-                "sha256:4186fc95c9febeab5681bc3248553d5ec8c2999b8424d4fc3a39c9cba5796962",
-                "sha256:46794c815e56f1431c66d81943fa90721bb858375fb36e5903697d5eef88627d",
-                "sha256:4869ab1c1ed33953bb2433ce7b894a28d724b7aa76c19b11e2878034a4e4680b",
-                "sha256:4f6428b55d2916a69f8d6453e48a505c07b2245653b0aa9f0dee38785939f5e4",
-                "sha256:52f185ffd3291196dc1aae506b42e178a592b0b60a8610b108e6ad892cfc1bb3",
-                "sha256:538f2fd5eb64366f37c97fdb3077d665fa946d2b6d95447622292f38407f9258",
-                "sha256:64c4f340338c68c463f1b56e3f2f0423f7b17ba6c3febae80b81f0e093077f59",
-                "sha256:675192fca634f0df69af3493a48224f211f8db4e84452b08d5fcebb9167adb01",
-                "sha256:700997b77cfab016533b3e7dbc03b71d33ee4df1d79f2463a318ca0263fc29dd",
-                "sha256:8505e614c983834239f865da2dd336dcf9d72776b951d5dfa5ac36b987726e1b",
-                "sha256:962c44070c281d86398aeb8f64e1bf37816a4dfc6f4c0f114756b14fc575621d",
-                "sha256:9e536783a5acee79a9b308be97d3952b662748c4037b6a24cbb339dc7ed8eb89",
-                "sha256:9ea749fd447ce7fb1ac71f7616371f04054d969d412d37611716721931e36efd",
-                "sha256:a34cb28e0747ea15e82d13e14de606747e9e484fb28d63c999483f5d5188e89b",
-                "sha256:a3ee9c793ffefe2944d3a2bd928a0e436cd0ac2d9e3723152d6fd5398838ce7d",
-                "sha256:aab75d99f3f2874733946a7648ce87a50019eb90baef931698f96b76b6769a46",
-                "sha256:b1ed2bdb27b4c9fc87058a1cb751c4df8752002143ed393899edb82b131e0546",
-                "sha256:b360d8fd88d2bad01cb953d81fd2edd4be539df7bfec41e8753fe9f4456a5082",
-                "sha256:b8f58c7db64d8f27078cbf2a4391af6aa4e4767cc08b37555c4ae064b8558d9b",
-                "sha256:c1bbb628ed5192124889b51204de27c575b3ffc05a5a91307e7640eff1d48da4",
-                "sha256:c2ff24df02a125b7b346c4c9078c8936da06964cc2d276292c357d64378158f8",
-                "sha256:c890728a93fffd0407d7d37c1e6083ff3f9f211c83b4316fae3778417eab9811",
-                "sha256:c96472b8ca5dc135fb0aa62f79b033f02aa434fb03a8b190600a5ae4102df1fd",
-                "sha256:ce7866f29d3025b5b34c2e944e66ebef0d92e4a4f2463f7266daa03a1332a651",
-                "sha256:e26c993bd4b220429d4ec8c1468eca445a4064a61c74ca08da7429af9bc53bb0"
+                "sha256:0203acd33d2298e19b57451ebb0bed0ab0c602e5cf5a818591b4918b1f97d516",
+                "sha256:0f313707cdecd5cd3e217fc68c78a960b616604b559e9ea60cc16795c4304259",
+                "sha256:1c6703094c81fa55b816f5ae542c6ffc625fec769f22b053adb42ad712d086c9",
+                "sha256:1d44bb3a652fed01f1f2c10d5477956116e9b391320c94d36c6bf13b088a1097",
+                "sha256:280baa8ec489c4f542f8940f9c4c2181f0306a8ee1a54eceba071a449fb870a0",
+                "sha256:29a6272fec10623fcbe158fdf9abc7a5fa032048ac1d8631f14b50fbfc10d17f",
+                "sha256:2b31f46bf7b31e6aa690d4c7a3d51bb262438c6dcb0d528adde446531d0d3bb7",
+                "sha256:2d43af2be93ffbad25dd959899b5b809618a496926146ce98ee0b23683f8c51c",
+                "sha256:381ead10b9b9af5f64646cd27107fb27b614ee7040bb1226f9c07ba96625cbb5",
+                "sha256:47a11bdbd8ada9b7ee628596f9d97fbd3851bd9999d398e9436bd67376dbece7",
+                "sha256:4d6a42744139a7fa5b46a264874a781e8694bb32f1d76d8137b68138686f1729",
+                "sha256:50691e744714856f03a86df3e2bff847c2acede4c191f9a1da38f088df342978",
+                "sha256:530cc8aaf11cc2ac7430f3614b04645662ef20c348dce4167c22d99bec3480e9",
+                "sha256:582ddfbe712025448206a5bc45855d16c2e491c2dd102ee9a2841418ac1c629f",
+                "sha256:63808c30b41f3bbf65e29f7280bf793c79f54fb807057de7e5238ffc7cc4d7b9",
+                "sha256:71b69bd716698fa62cd97137d6f2fdf49f534decb23a2c6fc80813e8b7be6822",
+                "sha256:7858847f2d84bf6e64c7f66498e851c54de8ea06a6f96a32a1d192d846734418",
+                "sha256:78e93cc3571fd928a39c0b26767c986188a4118edc67bc0695bc7a284da22e82",
+                "sha256:7f43286f13d91a34fadf61ae252a51a130223c52bfefb50310d5b2deb062cf0f",
+                "sha256:86e9f8cd4b0cdd57b4ae71a9c186717daa4c5a99f3238a8723f416256e0b064d",
+                "sha256:8f264ba2701b8c9f815b272ad568d555ef98dfe1576802ab3149c3629a9f2221",
+                "sha256:9342dd70a1e151684727c9c91ea003b2fb33523bf19385d4554f7897ca0141d4",
+                "sha256:9361de40701666b034c59ad9e317bae95c973b9ff92513dd0eced11c6adf2e21",
+                "sha256:9669179786254a2e7e57f0ecf224e978471491d660aaca833f845b72a2df3709",
+                "sha256:aac1ba0a253e17889550ddb1b60a2063f7474155465577caa2a3b131224cfd54",
+                "sha256:aef72eae10b5e3116bac6957de1df4d75909fc76d1499a53fb6387434b6bcd8d",
+                "sha256:bd3166bb3b111e76a4f8e2980fa1addf2920a4ca9b2b8ca36a3bc3dedc618270",
+                "sha256:c1b78fb9700fc961f53386ad2fd86d87091e06ede5d118b8a50dea285a071c24",
+                "sha256:c3888a051226e676e383de03bf49eb633cd39fc829516e5334e69b8d81aae751",
+                "sha256:c5f17ad25d2c1286436761b462e22b5020d83316f8e8fcb5deb2b3151f8f1d3a",
+                "sha256:c851b35fc078389bc16b915a0a7c1d5923e12e2c5aeec58c52f4aa8085ac8237",
+                "sha256:cb7df71de0af56000115eafd000b867d1261f786b5eebd88a0ca6360cccfaca7",
+                "sha256:cedb2f9e1f990918ea061f28a0f0077a07702e3819602d3507e2ff98c8d20636",
+                "sha256:e8caf961e1b1a945db76f1b5fa9c91498d15f545ac0ababbe575cfab185d3bd8"
             ],
             "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
-            "version": "==5.2.1"
+            "version": "==5.3"
         },
-        "funcsigs": {
+        "flake8": {
             "hashes": [
-                "sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca",
-                "sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50"
+                "sha256:15e351d19611c887e482fb960eae4d44845013cc142d42896e9862f775d8cf5c",
+                "sha256:f04b9fcbac03b0a3e58c0ab3a0ecc462e023a9faf046d57794184028123aa208"
             ],
-            "markers": "python_version < '3.3'",
-            "version": "==1.0.2"
+            "index": "pypi",
+            "version": "==3.8.3"
         },
         "fuzzyfinder": {
             "hashes": [
@@ -242,6 +193,13 @@
             "editable": true,
             "path": "."
         },
+        "iniconfig": {
+            "hashes": [
+                "sha256:80cf40c597eb564e86346103f609d74efce0f6b4d4f30ec8ce9e2c26411ba437",
+                "sha256:e5f92f89355a67de0595932a6c6c02ab4afddc6fcdc0bfc5becd0d60884d3f69"
+            ],
+            "version": "==1.0.1"
+        },
         "jsane": {
             "hashes": [
                 "sha256:b9649598966f4825273d24ffe3f5957e410cae96086d6cc6e3227b3a63ff06cd",
@@ -250,22 +208,20 @@
             "index": "pypi",
             "version": "==0.1.2"
         },
-        "mock": {
+        "mccabe": {
             "hashes": [
-                "sha256:83657d894c90d5681d62155c82bda9c1187827525880eda8ff5df4ec813437c3",
-                "sha256:d157e52d4e5b938c550f39eb2fd15610db062441a9c2747d3dbfa9298211d0f8"
+                "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42",
+                "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"
             ],
-            "index": "pypi",
-            "version": "==3.0.5"
+            "version": "==0.6.1"
         },
         "more-itertools": {
             "hashes": [
-                "sha256:38a936c0a6d98a38bcc2d03fdaaedaba9f412879461dd2ceff8d37564d6522e4",
-                "sha256:c0a5785b1109a6bd7fac76d6837fd1feca158e54e521ccd2ae8bfe393cc9d4fc",
-                "sha256:fe7a7cae1ccb57d33952113ff4fa1bc5f879963600ed74918f1236e212ee50b9"
+                "sha256:6f83822ae94818eae2612063a5101a7311e68ae8002005b5e05f03fd74a86a20",
+                "sha256:9b30f12df9393f0d28af9210ff8efe48d10c94f73e5daf886f10c4b0b0b4f03c"
             ],
-            "markers": "python_version <= '2.7'",
-            "version": "==5.0.0"
+            "markers": "python_version >= '3.5'",
+            "version": "==8.5.0"
         },
         "packaging": {
             "hashes": [
@@ -275,14 +231,6 @@
             "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
             "version": "==20.4"
         },
-        "pathlib2": {
-            "hashes": [
-                "sha256:0ec8205a157c80d7acc301c0b18fbd5d44fe655968f5d947b6ecef5290fc35db",
-                "sha256:6cd9a47b597b37cc57de1c05e56fb1a1c9cc9fab04fe78c29acd090418529868"
-            ],
-            "markers": "python_version < '3.6'",
-            "version": "==2.3.5"
-        },
         "pluggy": {
             "hashes": [
                 "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0",
@@ -293,12 +241,11 @@
         },
         "prompt-toolkit": {
             "hashes": [
-                "sha256:37925b37a4af1f6448c76b7606e0285f79f434ad246dda007a27411cca730c6d",
-                "sha256:dd4fca02c8069497ad931a2d09914c6b0d1b50151ce876bc15bde4c747090126",
-                "sha256:f7eec66105baf40eda9ab026cd8b2e251337eea8d111196695d82e0c5f0af852"
+                "sha256:822f4605f28f7d2ba6b0b09a31e25e140871e96364d1d377667b547bb3bf4489",
+                "sha256:83074ee28ad4ba6af190593d4d4c607ff525272a504eb159199b6dd9f950c950"
             ],
             "index": "pypi",
-            "version": "==1.0.18"
+            "version": "==3.0.7"
         },
         "py": {
             "hashes": [
@@ -308,13 +255,21 @@
             "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
             "version": "==1.9.0"
         },
-        "pygments": {
+        "pycodestyle": {
             "hashes": [
-                "sha256:2a3fe295e54a20164a9df49c75fa58526d3be48e14aceba6d6b1e8ac0bfd6f1b",
-                "sha256:98c8aa5a9f778fcd1026a17361ddaf7330d1b7c62ae97c3bb0ae73e0b9b6b0fe"
+                "sha256:2295e7b2f6b5bd100585ebcb1f616591b652db8a741695b3d8f5d28bdc934367",
+                "sha256:c58a7d2815e0e8d7972bf1803331fb0152f867bd89adf8a01dfd55085434192e"
             ],
-            "index": "pypi",
-            "version": "==2.5.2"
+            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
+            "version": "==2.6.0"
+        },
+        "pyflakes": {
+            "hashes": [
+                "sha256:0d94e0e05a19e57a99444b6ddcf9a6eb2e5c68d3ca1e98e90707af8152c90a92",
+                "sha256:35b2d75ee967ea93b55750aa9edbbf72813e06a66ba54438df2cfac9e3c27fc8"
+            ],
+            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
+            "version": "==2.2.0"
         },
         "pyparsing": {
             "hashes": [
@@ -326,11 +281,11 @@
         },
         "pytest": {
             "hashes": [
-                "sha256:50fa82392f2120cc3ec2ca0a75ee615be4c479e66669789771f1758332be4353",
-                "sha256:a00a7d79cbbdfa9d21e7d0298392a8dd4123316bfac545075e6f8f24c94d8c97"
+                "sha256:0e37f61339c4578776e090c3b8f6b16ce4db333889d65d0efb305243ec544b40",
+                "sha256:c8f57c2a30983f469bf03e68cdfa74dc474ce56b8f280ddcb080dfd91df01043"
             ],
             "index": "pypi",
-            "version": "==4.6.11"
+            "version": "==6.0.2"
         },
         "pytest-cov": {
             "hashes": [
@@ -348,23 +303,6 @@
             "index": "pypi",
             "version": "==2.24.0"
         },
-        "scandir": {
-            "hashes": [
-                "sha256:2586c94e907d99617887daed6c1d102b5ca28f1085f90446554abf1faf73123e",
-                "sha256:2ae41f43797ca0c11591c0c35f2f5875fa99f8797cb1a1fd440497ec0ae4b022",
-                "sha256:2b8e3888b11abb2217a32af0766bc06b65cc4a928d8727828ee68af5a967fa6f",
-                "sha256:2c712840c2e2ee8dfaf36034080108d30060d759c7b73a01a52251cc8989f11f",
-                "sha256:4d4631f6062e658e9007ab3149a9b914f3548cb38bfb021c64f39a025ce578ae",
-                "sha256:67f15b6f83e6507fdc6fca22fedf6ef8b334b399ca27c6b568cbfaa82a364173",
-                "sha256:7d2d7a06a252764061a020407b997dd036f7bd6a175a5ba2b345f0a357f0b3f4",
-                "sha256:8c5922863e44ffc00c5c693190648daa6d15e7c1207ed02d6f46a8dcc2869d32",
-                "sha256:92c85ac42f41ffdc35b6da57ed991575bdbe69db895507af88b9f499b701c188",
-                "sha256:b24086f2375c4a094a6b51e78b4cf7ca16c721dcee2eddd7aa6494b42d6d519d",
-                "sha256:cb925555f43060a1745d0a321cca94bcea927c50114b623d73179189a4e100ac"
-            ],
-            "markers": "python_version < '3.5'",
-            "version": "==1.10.0"
-        },
         "six": {
             "hashes": [
                 "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259",
@@ -373,6 +311,13 @@
             "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
             "version": "==1.15.0"
         },
+        "toml": {
+            "hashes": [
+                "sha256:926b612be1e5ce0634a2ca03470f95169cf16f939018233a670519cb4ac58b0f",
+                "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88"
+            ],
+            "version": "==0.10.1"
+        },
         "urllib3": {
             "hashes": [
                 "sha256:91056c15fa70756691db97756772bb1eb9678fa585d9184f24534b100dc60f4a",
@@ -390,11 +335,11 @@
         },
         "zipp": {
             "hashes": [
-                "sha256:c70410551488251b0fee67b460fb9a536af8d6f9f008ad10ac51f615b6a521b1",
-                "sha256:e0d9e63797e483a30d27e09fffd308c59a700d365ec34e93cc100844168bf921"
+                "sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b",
+                "sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96"
             ],
-            "markers": "python_version >= '2.7'",
-            "version": "==1.2.0"
+            "markers": "python_version >= '3.6'",
+            "version": "==3.1.0"
         }
     }
 }
diff --git a/README.md b/README.md
index ea1181f..752ca62 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ Inspired by [pgcli](https://github.com/dbcli/pgcli), [http-prompt
 
 Requirement
 --------
-Python 2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9, *nix system.
+Python 3.6+, *nix system.
 
 It hasn't tested on Windows.
 
diff --git a/influx_prompt/completer.py b/influx_prompt/completer.py
index 66a9e5a..ffc689b 100644
--- a/influx_prompt/completer.py
+++ b/influx_prompt/completer.py
@@ -1,4 +1,3 @@
-from __future__ import absolute_import, unicode_literals
 from prompt_toolkit.completion import Completer, Completion
 from fuzzyfinder import fuzzyfinder
 
diff --git a/influx_prompt/extra_command.py b/influx_prompt/extra_command.py
index 041ffb4..48b81dc 100644
--- a/influx_prompt/extra_command.py
+++ b/influx_prompt/extra_command.py
@@ -1,4 +1,3 @@
-from __future__ import absolute_import, unicode_literals
 import re
 
 
diff --git a/influx_prompt/influx_client.py b/influx_prompt/influx_client.py
index 7ddf0e9..509a48c 100644
--- a/influx_prompt/influx_client.py
+++ b/influx_prompt/influx_client.py
@@ -1,4 +1,3 @@
-from __future__ import absolute_import, unicode_literals
 import re
 import time
 import random
diff --git a/influx_prompt/main.py b/influx_prompt/main.py
index f588daf..302b02b 100644
--- a/influx_prompt/main.py
+++ b/influx_prompt/main.py
@@ -1,18 +1,10 @@
-from __future__ import absolute_import, unicode_literals
 import argparse
 import getpass
 
-from prompt_toolkit import CommandLineInterface, Application, AbortAction
-from prompt_toolkit.buffer import Buffer, AcceptAction
-from prompt_toolkit.shortcuts import (
-    create_prompt_layout, create_eventloop, print_tokens
-)
-from prompt_toolkit.key_binding.manager import KeyBindingManager
-from prompt_toolkit.filters import Always
+from prompt_toolkit import prompt, print_formatted_text, PromptSession
 from prompt_toolkit.history import InMemoryHistory
-from prompt_toolkit.layout.lexers import PygmentsLexer
-from prompt_toolkit.styles import style_from_dict
-from pygments.token import Token
+from prompt_toolkit.lexers import PygmentsLexer
+from prompt_toolkit.formatted_text import FormattedText
 from pygments.lexers.sql import SqlLexer
 
 from . import __version__
@@ -23,110 +15,81 @@ from .tabular import json_to_tabular_result
 
 
 class InfluxPrompt(object):
-    style = style_from_dict({
-        Token.Red: '#ff0000',
-        Token.Orange: '#ff8000',
-        Token.Yellow: '#ffff00',
-        Token.Green: '#44ff44',
-        Token.Blue: '#0000ff',
-        Token.Indigo: '#4b0082',
-        Token.Violet: '#9400d3'
-    })
-
     def __init__(self, args, password):
         self.args = args
         self.args['password'] = password
         self.completer = InfluxCompleter()
         self.history = InMemoryHistory()
-        self.eventloop = create_eventloop()
         self.influx_client = Client(self.args)
 
         self.influx_client.ping()
-        self.cli = self._build_cli()
 
     def run_cli(self):
         print('Version: {0}'.format(__version__))
-        print_tokens([
-            (Token.Red, 'W'),
-            (Token.Orange, 'e'),
-            (Token.Yellow, 'l'),
-            (Token.Green, 'c'),
-            (Token.Blue, 'o'),
-            (Token.Indigo, 'm'),
-            (Token.Violet, 'e'),
-        ], style=self.style)
-        print('!')
-        print_tokens([
-            (Token.Green, 'Any issue please post to '),
-            (Token.Yellow, 'https://github.com/RPing/influx-prompt/issues'),
-            (Token, '\n'),
-        ], style=self.style)
+        print_formatted_text(FormattedText([
+            ('ansibrightred', 'W'),
+            ('orange', 'e'),
+            ('ansibrightyellow', 'l'),
+            ('ansibrightgreen', 'c'),
+            ('blue', 'o'),
+            ('indigo', 'm'),
+            ('purple', 'e'),
+            ('', '!')
+        ]), end='')
+        print_formatted_text(FormattedText([
+            ('', 'Any issue please post to '),
+            ('ansibrightgreen', 'https://github.com/RPing/influx-prompt/issues'),
+        ]))
         if self.args['database'] is None:
-            print_tokens([(Token.Yellow, '[Warning] ')], style=self.style)
+            print_formatted_text(FormattedText([
+                ('ansibrightyellow', '[Warning] '),
+            ]), end='')
             print('You havn\'t set database. '
                   'use "use <database>" to specify database.')
 
-        try:
-            while True:
-                document = self.cli.run()
-                query = document.text.strip()
-                if query == '':
-                    continue
-
-                msg = process_extra_command(self.args, query)
-                if msg:
-                    print(msg)
-                    continue
-
-                result = self.influx_client.query(
-                    query,
-                    self.args['database'],
-                    self.args['epoch'],
-                )
-
-                # top-level error.
-                if 'error' in result:
-                    print_tokens([
-                        (Token.Red, '[ERROR] '),
-                    ], style=self.style)
-                    print(result['error'])
-                    continue
-
-                arr = json_to_tabular_result(result)
-                print_tokens(arr, style=self.style)
-        except EOFError:
-            print('Goodbye!')
-
-    def _build_cli(self):
-        layout = create_prompt_layout(
-            message='{0}> '.format(self.args['username']),
+        session = PromptSession(
             lexer=PygmentsLexer(SqlLexer),
-        )
-
-        buf = Buffer(
-            completer=self.completer,
-            history=self.history,
-            complete_while_typing=Always(),
-            accept_action=AcceptAction.RETURN_DOCUMENT
-        )
-
-        key_binding_manager = KeyBindingManager(
-            enable_abort_and_exit_bindings=True,
-        )
-
-        application = Application(
-            layout=layout,
-            buffer=buf,
-            key_bindings_registry=key_binding_manager.registry,
-            on_exit=AbortAction.RAISE_EXCEPTION,
-            on_abort=AbortAction.RETRY,
-            ignore_case=True
-        )
-
-        cli = CommandLineInterface(application=application,
-                                   eventloop=self.eventloop)
-
-        return cli
+            search_ignore_case=True,
+            history=self.history)
+
+        prompt_text = '{0}> '.format(self.args['username'])
+        while True:
+            try:
+                query = session.prompt(
+                    prompt_text,
+                    completer=self.completer,
+                    complete_while_typing=True)
+            except KeyboardInterrupt:
+                continue
+            except EOFError:
+                print('Goodbye!')
+                return
+
+            query = query.strip()
+            if query == '':
+                continue
+
+            msg = process_extra_command(self.args, query)
+            if msg:
+                print(msg)
+                continue
+
+            result = self.influx_client.query(
+                query,
+                self.args['database'],
+                self.args['epoch'],
+            )
+
+            # top-level error.
+            if 'error' in result:
+                print_formatted_text(FormattedText([
+                    ('ansibrightred', '[ERROR] '),
+                ]), end='')
+                print(result['error'])
+                continue
+
+            arr = json_to_tabular_result(result)
+            print_formatted_text(FormattedText(arr))
 
 
 def cli():
diff --git a/influx_prompt/tabular.py b/influx_prompt/tabular.py
index 1d3dead..149f2fc 100644
--- a/influx_prompt/tabular.py
+++ b/influx_prompt/tabular.py
@@ -1,6 +1,4 @@
-from __future__ import absolute_import, unicode_literals
 import jsane
-from pygments.token import Token
 
 from .compat import string
 
@@ -13,9 +11,9 @@ def json_to_tabular_result(j):
 
     for r in results:
         if 'error' in r:
-            tabular_result.append((Token.Red, '[ERROR] '))
-            tabular_result.append((Token, r['error']))
-            tabular_result.append((Token, '\n'))
+            tabular_result.append(('ansibrightred', '[ERROR] '))
+            tabular_result.append(('', r['error']))
+            tabular_result.append(('', '\n'))
             continue
 
         rr = jsane.from_dict(r)
@@ -36,42 +34,41 @@ def json_to_tabular_result(j):
             )
 
             if name is not None:
-                tabular_result.append((Token, 'name: '))
-                tabular_result.append((Token.Green, name))
-                tabular_result.append((Token, '\n'))
+                tabular_result.append(('', 'name: '))
+                tabular_result.append(('ansibrightgreen', name))
+                tabular_result.append(('', '\n'))
 
             for index, column in enumerate(columns):
                 tabular_result.append((
-                    Token.Orange,
+                    'orange',
                     '{column: <{width}}'.format(
                         column=column,
                         width=longest_value_len[index]+2
                     )
                 ))
-            tabular_result.append((Token, '\n'))
+            tabular_result.append(('', '\n'))
 
             for index in range(column_amount):
                 tabular_result.append((
-                    Token.Orange,
+                    'orange',
                     '{divider: <{width}}'.format(
                         divider='---',
                         width=longest_value_len[index]+2
                     )
                 ))
-            tabular_result.append((Token, '\n'))
+            tabular_result.append(('', '\n'))
 
             for value in values:
                 for index, value_ in enumerate(value):
                     tabular_result.append((
-                        Token,
+                        '',
                         '{value: <{width}}'.format(
                             value=string(value_),
                             width=longest_value_len[index]+2
                         )
                     ))
-                tabular_result.append((Token, '\n'))
-            tabular_result.append((Token, '\n'))
-    tabular_result.append((Token, '\n'))
+                tabular_result.append(('', '\n'))
+            tabular_result.append(('', '\n'))
 
     return tabular_result
 
diff --git a/requirements.txt b/requirements.txt
index 87b0d8b..3bea554 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,12 +1,10 @@
-backports.functools-lru-cache==1.6.1; python_version < '3.2'
 certifi==2020.6.20
 chardet==3.0.4
 fuzzyfinder==2.1.0
 idna==2.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
 jsane==0.1.2
-prompt-toolkit==1.0.18
-pygments==2.5.2
+prompt-toolkit==3.0.7
+pygments==2.7.1
 requests==2.24.0
-six==1.15.0; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'
 urllib3==1.25.10; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'
 wcwidth==0.2.5
diff --git a/setup.py b/setup.py
index 1e5467d..8a8a526 100644
--- a/setup.py
+++ b/setup.py
@@ -46,9 +46,6 @@ setup(
         'Topic :: Terminals',
         'Topic :: Text Processing',
         'Topic :: Utilities',
-        'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3.4',
-        'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',


Test patch:
diff --git a/tests/test_client.py b/tests/test_client.py
index 6141be8..455cb51 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -2,7 +2,7 @@ import random
 import requests
 
 import pytest
-import mock
+from unittest import mock
 
 from .utils import create_test_db, drop_test_db, select_test_db, ping, MockRequest
 from influx_prompt.influx_client import Client
diff --git a/tests/test_completer.py b/tests/test_completer.py
index 8699839..d743d0a 100644
--- a/tests/test_completer.py
+++ b/tests/test_completer.py
@@ -1,4 +1,3 @@
-from __future__ import absolute_import, unicode_literals
 import pytest
 from prompt_toolkit.completion import Completion
 from prompt_toolkit.document import Document
@@ -6,7 +5,7 @@ from prompt_toolkit.document import Document
 
 @pytest.fixture
 def complete_event():
-    from mock import Mock
+    from unittest.mock import Mock
     return Mock()
 
 
@@ -19,10 +18,10 @@ def completer():
 def test_keyword_completion(completer, complete_event):
     text = 'SEL'
     position = len(text)
-    result = set(completer.get_completions(
+    result = list(completer.get_completions(
         Document(text=text, cursor_position=position),
         complete_event))
-    assert result == set([
+    assert result == list([
         Completion(text='SELECT', start_position=-3, display_meta='keyword')
     ])
 
@@ -30,9 +29,9 @@ def test_keyword_completion(completer, complete_event):
 def test_function_completion(completer, complete_event):
     text = 'COUN'
     position = len(text)
-    result = set(completer.get_completions(
+    result = list(completer.get_completions(
         Document(text=text, cursor_position=position),
         complete_event))
-    assert result == set([
+    assert result == list([
         Completion(text='COUNT()', start_position=-4, display_meta='function')
     ])
diff --git a/tests/test_tabular.py b/tests/test_tabular.py
index ab23397..74445c8 100644
--- a/tests/test_tabular.py
+++ b/tests/test_tabular.py
@@ -1,5 +1,3 @@
-from pygments.token import Token
-
 from influx_prompt.tabular import json_to_tabular_result
 
 
@@ -12,10 +10,9 @@ def test_error_in_json():
     }
     result = json_to_tabular_result(j)
     assert result == [
-        (Token.Red, '[ERROR] '),
-        (Token, 'database name required'),
-        (Token, '\n'),
-        (Token, '\n')
+        ('ansibrightred', '[ERROR] '),
+        ('', 'database name required'),
+        ('', '\n'),
     ]
 
 
@@ -32,23 +29,22 @@ def test_ordinary_json():
     }
     result = json_to_tabular_result(j)
     assert result == [
-        (Token, 'name: '),
-        (Token.Green, 'mymeas'),
-        (Token, '\n'),
-        (Token.Orange, 'time                            '),
-        (Token.Orange, 'myfield  '),
-        (Token.Orange, 'mytag  '),
-        (Token, '\n'),
-        (Token.Orange, '---                             '),
-        (Token.Orange, '---      '),
-        (Token.Orange, '---    '),
-        (Token, '\n'),
-        (Token, '2018-04-22T11:33:25.512241551Z  '),
-        (Token, '91       '),
-        (Token, '1      '),
-        (Token, '\n'),
-        (Token, '\n'),
-        (Token, '\n')
+        ('', 'name: '),
+        ('ansibrightgreen', 'mymeas'),
+        ('', '\n'),
+        ('orange', 'time                            '),
+        ('orange', 'myfield  '),
+        ('orange', 'mytag  '),
+        ('', '\n'),
+        ('orange', '---                             '),
+        ('orange', '---      '),
+        ('orange', '---    '),
+        ('', '\n'),
+        ('', '2018-04-22T11:33:25.512241551Z  '),
+        ('', '91       '),
+        ('', '1      '),
+        ('', '\n'),
+        ('', '\n'),
     ]
 
 
@@ -68,27 +64,26 @@ def test_empty_value_in_json():
     }
     result = json_to_tabular_result(j)
     assert result == [
-        (Token, 'name: '),
-        (Token.Green, 'mymeas'),
-        (Token, '\n'),
-        (Token.Orange, 'time                            '),
-        (Token.Orange, 'myfield  '),
-        (Token.Orange, 'mytag  '),
-        (Token, '\n'),
-        (Token.Orange, '---                             '),
-        (Token.Orange, '---      '),
-        (Token.Orange, '---    '),
-        (Token, '\n'),
-        (Token, '2018-04-22T11:33:25.512241551Z  '),
-        (Token, '91       '),
-        (Token, '1      '),
-        (Token, '\n'),
-        (Token, '2018-05-23T12:08:32.214580837Z  '),
-        (Token, '91       '),
-        (Token, '       '),
-        (Token, '\n'),
-        (Token, '\n'),
-        (Token, '\n')
+        ('', 'name: '),
+        ('ansibrightgreen', 'mymeas'),
+        ('', '\n'),
+        ('orange', 'time                            '),
+        ('orange', 'myfield  '),
+        ('orange', 'mytag  '),
+        ('', '\n'),
+        ('orange', '---                             '),
+        ('orange', '---      '),
+        ('orange', '---    '),
+        ('', '\n'),
+        ('', '2018-04-22T11:33:25.512241551Z  '),
+        ('', '91       '),
+        ('', '1      '),
+        ('', '\n'),
+        ('', '2018-05-23T12:08:32.214580837Z  '),
+        ('', '91       '),
+        ('', '       '),
+        ('', '\n'),
+        ('', '\n'),
     ]
 
 
@@ -113,53 +108,52 @@ def test_multiple_series_json():
     }
     result = json_to_tabular_result(j)
     assert result == [
-        (Token, 'name: '),
-        (Token.Green, 'mymeas'),
-        (Token, '\n'),
-        (Token.Orange, 'time                            '),
-        (Token.Orange, 'myfield  '),
-        (Token.Orange, 'mytag  '),
-        (Token, '\n'),
-        (Token.Orange, '---                             '),
-        (Token.Orange, '---      '),
-        (Token.Orange, '---    '),
-        (Token, '\n'),
-        (Token, '2018-04-22T11:33:25.512241551Z  '),
-        (Token, '91       '),
-        (Token, '1      '),
-        (Token, '\n'),
-        (Token, '\n'),
-        (Token, 'name: '),
-        (Token.Green, 'mymeas'),
-        (Token, '\n'),
-        (Token.Orange, 'time                            '),
-        (Token.Orange, 'myfield  '),
-        (Token.Orange, 'mytag  '),
-        (Token, '\n'),
-        (Token.Orange, '---                             '),
-        (Token.Orange, '---      '),
-        (Token.Orange, '---    '),
-        (Token, '\n'),
-        (Token, '2018-04-22T11:33:25.512241551Z  '),
-        (Token, '92       '),
-        (Token, '1      '),
-        (Token, '\n'),
-        (Token, '\n'),
-        (Token, 'name: '),
-        (Token.Green, 'mymeas'),
-        (Token, '\n'),
-        (Token.Orange, 'time                            '),
-        (Token.Orange, 'myfield  '),
-        (Token.Orange, 'mytag  '),
-        (Token, '\n'),
-        (Token.Orange, '---                             '),
-        (Token.Orange, '---      '),
-        (Token.Orange, '---    '),
-        (Token, '\n'),
-        (Token, '2018-04-22T11:33:25.512241551Z  '),
-        (Token, '93       '),
-        (Token, '1      '),
-        (Token, '\n'),
-        (Token, '\n'),
-        (Token, '\n')
+        ('', 'name: '),
+        ('ansibrightgreen', 'mymeas'),
+        ('', '\n'),
+        ('orange', 'time                            '),
+        ('orange', 'myfield  '),
+        ('orange', 'mytag  '),
+        ('', '\n'),
+        ('orange', '---                             '),
+        ('orange', '---      '),
+        ('orange', '---    '),
+        ('', '\n'),
+        ('', '2018-04-22T11:33:25.512241551Z  '),
+        ('', '91       '),
+        ('', '1      '),
+        ('', '\n'),
+        ('', '\n'),
+        ('', 'name: '),
+        ('ansibrightgreen', 'mymeas'),
+        ('', '\n'),
+        ('orange', 'time                            '),
+        ('orange', 'myfield  '),
+        ('orange', 'mytag  '),
+        ('', '\n'),
+        ('orange', '---                             '),
+        ('orange', '---      '),
+        ('orange', '---    '),
+        ('', '\n'),
+        ('', '2018-04-22T11:33:25.512241551Z  '),
+        ('', '92       '),
+        ('', '1      '),
+        ('', '\n'),
+        ('', '\n'),
+        ('', 'name: '),
+        ('ansibrightgreen', 'mymeas'),
+        ('', '\n'),
+        ('orange', 'time                            '),
+        ('orange', 'myfield  '),
+        ('orange', 'mytag  '),
+        ('', '\n'),
+        ('orange', '---                             '),
+        ('orange', '---      '),
+        ('orange', '---    '),
+        ('', '\n'),
+        ('', '2018-04-22T11:33:25.512241551Z  '),
+        ('', '93       '),
+        ('', '1      '),
+        ('', '\n'),
+        ('', '\n'),
     ]