{"id":333349,"date":"2022-05-19T09:00:50","date_gmt":"2022-05-19T09:00:50","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=333349"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=333349","title":{"rendered":"<span>\u041c\u043e\u0439 \u043e\u043f\u044b\u0442 \u0441 \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u044b\u043c \u043c\u0443\u0436\u0438\u043a\u043e\u043c. Github Copilot<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/2ef\/300\/e04\/2ef300e04cdb9cf3ca8290421a5bc7f6.jpg\" width=\"800\" height=\"400\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2ef\/300\/e04\/2ef300e04cdb9cf3ca8290421a5bc7f6.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u043c\u043e\u044f \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u044f \u0441 Github Copilot &#8212; \u044d\u0442\u043e \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u044b\u0439 \u043c\u0443\u0436\u0438\u043a-\u0430\u0432\u0442\u043e\u043f\u0438\u043b\u043e\u0442 \u0438\u0437 \u0444\u0438\u043b\u044c\u043c\u0430 &#171;\u0410\u044d\u0440\u043e\u043f\u043b\u0430\u043d&#187;. \u041f\u043e\u043c\u043d\u044e, \u0432 \u0434\u0435\u0442\u0441\u0442\u0432\u0435 \u044f \u0443\u0432\u0438\u0434\u0435\u043b \u044d\u0442\u043e\u0442 \u0444\u0438\u043b\u044c\u043c \u0438 \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u0442\u0430\u043a \u0430\u0432\u0442\u043e\u043f\u0438\u043b\u043e\u0442\u044b \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442: \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0441\u043c\u0435\u0448\u043d\u0430\u044f \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u0430\u044f \u043a\u0443\u043a\u043b\u0430 \u043d\u0430\u0434\u0443\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0430\u043c\u043e\u043b\u0451\u0442\u043e\u043c. \u0418 \u0432\u043e\u0442, \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043c\u0435\u043d\u044f \u043d\u0435 \u043f\u043e\u043a\u0438\u0434\u0430\u0435\u0442 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u043e \u043c\u043d\u043e\u0439 \u043d\u0430\u0434\u0443\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043a\u0443\u043a\u043b\u0430 \u0438 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430 \u043c\u0435\u043d\u044f \u043a\u043e\u0434.<\/p>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435, \u043d\u0435\u0436\u0434\u0430\u043d\u043d\u043e-\u043d\u0435\u0433\u0430\u0434\u0430\u043d\u043d\u043e \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u0451\u043b \u0438\u043d\u0432\u0430\u0439\u0442 \u0432 GitHub copilot. \u042f \u0438 \u0437\u0430\u0431\u044b\u043b \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u043b \u0434\u043e\u0441\u0442\u0443\u043f &#8212; \u0430\u0436\u0438\u043e\u0442\u0430\u0436 \u0434\u0430\u0432\u043d\u043e \u0443\u0436\u0435 \u0441\u043f\u0430\u043b, \u0432\u0440\u043e\u0434\u0435 \u043c\u0438\u0440 \u043d\u0435 \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043d \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u043e\u043d \u0438 \u043a\u0440\u0443\u0442\u043e\u0439, \u0434\u0430? \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043a \u043d\u0430\u043c \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044e senior python \u043f\u043e\u0441\u0442\u0443\u0447\u0430\u043b \u0447\u0435\u043b \u0438 \u0441\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043e\u043d \u0437\u0430\u043f\u0438\u043b\u0438\u043b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 copilot, \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e \u043a\u0442\u043e-\u0442\u043e &#171;\u043f\u0438\u043b\u043e\u0442\u043e\u043c&#187; \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e: \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043d\u043e \u0438\u043b\u0438 \u043f\u043b\u043e\u0445\u043e? \u0421\u0442\u0430\u043d\u0443 \u043b\u0438 \u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u043c? \u0415\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c: \u0432 \u0431\u043e\u044e.<\/p>\n<h2>\u041a\u0430\u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c?<\/h2>\n<p>\u0418 \u0442\u0443\u0442 \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f.<\/p>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0440\u0430\u0437\u043d\u044b\u0435.<\/p>\n<p>\u0412 copilot \u0442\u044b \u043f\u0438\u0448\u0435\u0448\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0438\u043b\u0438 \u043a\u043e\u0434, \u0438 \u043f\u043e \u043d\u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u043b\u043e\u0445\u043e\u0439 \u0438\u0434\u0435\u0435\u0439 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435:<\/p>\n<pre><code class=\"python\"># this is a bullshit code written by previous developer,  # zero tests (of course), please run it and see where it breaks  # and try to fix; also update all dependencies to latest  # (read changelogs and migrate db and code where needed)<\/code><\/pre>\n<p>\u041d\u0435\u0442, \u043d\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b, \u043d\u043e \u043c\u0443\u0436\u0438\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043c\u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e<\/p>\n<pre><code class=\"python\">def bullshit_code():<\/code><\/pre>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435, \u0442\u0430\u043a\u0438\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u0434\u043b\u044f copilot \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442. \u041b\u0443\u0447\u0448\u0438\u0439 \u043a\u0435\u0439\u0441, \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b &#8212; \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043b\u0430\u0441\u0441\u0430, \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u043b\u0438 \u0441\u043d\u0438\u043f\u043f\u0435\u0442\u0430 \u043a\u043e\u0434\u0430. \u0427\u0435\u0433\u043e-\u0442\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0433\u043e, \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u043e\u0439.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u0451 \u044d\u0442\u043e \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c. \u0410 \u043f\u043e\u0434 \u043a\u043e\u043d\u0435\u0446 \u0443\u0437\u043d\u0430\u0435\u043c, \u043a\u0442\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434: \u043a\u043e\u0436\u0430\u043d\u044b\u0439 \u043c\u0435\u0448\u043e\u043a \u0438\u043b\u0438 \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u044b\u0439 \u043c\u0443\u0436\u0438\u043a.<\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0443, \u0447\u0442\u043e \u043c\u0443\u0436\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043e 10 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 &#171;\u0432\u044b\u0431\u0438\u0440\u0430\u0439 \u0447\u0442\u043e \u0442\u0435\u0431\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f&#187;, \u043d\u043e \u044f \u0431\u0443\u0434\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0443\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e<\/p>\n<ol>\n<li>\n<p>\u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 &#8212; \u044d\u0442\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e (\u0430 copilot, \u043a\u0430\u043a \u0438 gpt, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430\/\u043a\u043e\u0434\u0430), \u0438 \u0437\u043d\u0430\u0447\u0438\u0442 \u0443 \u043c\u0443\u0436\u0438\u043a\u0430 \u044d\u0442\u043e\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0432 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0435 (\u0441\u0443\u0433\u0443\u0431\u043e \u043c\u043e\u0451 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435)<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0437 10 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043d\u0430\u043f\u0440\u043e\u0447\u044c \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u044e \u0438\u0434\u0435\u044e \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0430; \u0435\u0441\u043b\u0438 \u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0447\u0438\u0442\u0430\u0442\u044c 10 \u0441\u043d\u0438\u043f\u043f\u0435\u0442\u043e\u0432 \u043a\u043e\u0434\u0430 \u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u0439, \u0442\u043e \u044f \u043b\u0443\u0447\u0448\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043d\u0430\u043f\u0438\u0448\u0443 \u0441\u0430\u043c<\/p>\n<\/li>\n<\/ol>\n<h2>\u041c\u0438\u043d\u0438-\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h2>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0435. \u041a\u0430\u043a\u0443\u044e-\u043d\u0438\u0431\u0443\u0434\u044c \u043c\u0435\u043b\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u0430 \u0432 \u043e\u0433\u0440\u043e\u043c\u043d\u0443\u044e stdlib. \u041c\u043d\u0435 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u0441\u043a\u0443\u0447\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0437\u0434\u043e\u0440\u043e\u0432\u043e, \u0435\u0441\u043b\u0438 \u0443 \u043c\u0435\u043d\u044f \u0437\u0430\u0431\u0435\u0440\u0443\u0442 \u044d\u0442\u0443 \u0440\u0443\u0442\u0438\u043d\u0443.<\/p>\n<h3>\u0420\u0430\u0437\u0431\u0438\u0442\u0438\u0435 \u043f\u043e \u0447\u0430\u043d\u043a\u0430\u043c<\/h3>\n<p>\u042f \u043f\u0440\u044f\u043c \u0431\u0435\u0440\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u0437 <a href=\"https:\/\/more-itertools.readthedocs.io\/en\/stable\/api.html#more_itertools.chunked\" rel=\"noopener noreferrer nofollow\">more_itertools::chunked<\/a><\/p>\n<blockquote>\n<p>Break\u00a0<em>iterable<\/em>\u00a0into lists of length\u00a0<em>n<\/em><\/p>\n<\/blockquote>\n<pre><code class=\"python\">def chunks(lst, n):     for i in range(0, len(lst), n):         yield lst[i:i + n]  def chunks(lst, n):     return [lst[i:i+n] for i in range(0, len(lst), n)]<\/code><\/pre>\n<p>\u0414\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u043e\u0434\u0438\u043d \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a. \u042d\u0442\u043e \u0433\u043e\u0434\u043d\u043e!<\/p>\n<h3>Lookahead \u0431\u0435\u0437 \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/h3>\n<p>\u0422\u043e\u0436\u0435 \u0438\u0437 <a href=\"https:\/\/more-itertools.readthedocs.io\/en\/stable\/api.html#more_itertools.spy\" rel=\"noopener noreferrer nofollow\">more_itertools::spy<\/a><\/p>\n<blockquote>\n<p>Return a 2-tuple with a list containing the first\u00a0<em>n<\/em>\u00a0elements of\u00a0<em>iterable<\/em>, and an iterator with the same items as\u00a0<em>iterable<\/em>. This allows you to \u201clook ahead\u201d at the items in the iterable without advancing it.<\/p>\n<\/blockquote>\n<p>\u041f\u043e \u0444\u0430\u043a\u0442\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u044d\u0448 \u0438\u0437 <code>n<\/code> \u043f\u0435\u0440\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u044d\u0448 \u0438 \u0442\u0430\u043a\u0436\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c &#171;\u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439&#187; \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440.<\/p>\n<pre><code class=\"python\">def spy(iterable, n=1):   it = iter(iterable)  # \u043e! \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c iterable \u0432 iterable :)     cache = []     for i in range(n):         try:             cache.append(next(it))         except StopIteration:             break     return cache, it<\/code><\/pre>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0442\u043e! \u0422\u0443\u0442 \u0432\u0440\u043e\u0434\u0435 \u0435\u0441\u0442\u044c <code>cache<\/code>, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0443 copilot \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u0448\u0438\u0437\u043e\u0444\u0430\u0437\u0438\u044f. \u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0442\u0430\u043a\u043e\u0435:<\/p>\n<pre><code class=\"python\">from itertools import chain, islice   def spy(iterable, n=1):     head = list(islice(iterable, n))     return head, chain(head, iterable)<\/code><\/pre>\n<h3>\u0421\u0430\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u0430\u044f \u0431\u0443\u043a\u0432\u0430<\/h3>\n<p>\u041a\u0430\u043a-\u0442\u043e \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0438 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0443\u044e\u0441\u044f \u0431\u0443\u043a\u0432\u0443. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u044f \u0440\u043e\u0434\u0438\u043b \u0437\u0430 5 \u0441\u0435\u043a\u0443\u043d\u0434:<\/p>\n<pre><code class=\"python\">from collections import Counter   def most_common_letter(text: str) -> str:     return Counter(text).most_common(1)[0][0]<\/code><\/pre>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u0443\u0436\u0438\u043a \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043c\u043d\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>text.count(symbol)<\/code>:<\/p>\n<pre><code class=\"python\">def most_common_letter(text: str) -> str:     return max(text, key=text.count)<\/code><\/pre>\n<p>\u042f \u043d\u0430\u0447\u0438\u043d\u0430\u044e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c, \u043c\u043e\u043b, \u043c\u043e\u0436\u0435\u0442 \u0431\u0443\u0434\u0435\u043c \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b? \u041c\u0443\u0436\u0438\u043a \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442: \u0434\u0430\u0432\u0430\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>text.count(symbol)<\/code> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0430:<\/p>\n<pre><code class=\"python\">def most_common_letter(text: str) -> str:     return max(set(text), key=text.count)<\/code><\/pre>\n<p>\u041c\u043e\u0436\u0435\u0442, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 <code>Counter<\/code> \u043f\u043e\u044e\u0437\u0430\u0435\u043c?<\/p>\n<p>&#171;\u041e\u043a\u0435\u0439,&#187; &#8212; \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043c\u043d\u0435 \u043a\u043e\u043f\u0438\u043b\u043e\u0442, &#8212; &#171;\u0432\u043e\u0442 \u0442\u0435\u0431\u0435 \u0442\u0432\u043e\u0439 <code>Counter<\/code>&#171;:<\/p>\n<pre><code class=\"python\">def most_common_letter(text: str) -> str:     import collections     return max(collections.Counter(text).items(), key=lambda x: x[1])[0]<\/code><\/pre>\n<p>\u041d\u043e <code>Counter<\/code> \u0441\u0430\u043c \u0443\u043c\u0435\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c, \u0430 \u0442\u044b \u044e\u0437\u0430\u0435\u0448\u044c <code>max<\/code>!<\/p>\n<pre><code class=\"python\">def most_common_letter(text: str) -> str:     import collections     return collections.Counter(text).most_common(1)[0][0]<\/code><\/pre>\n<p>\u0418\u0442\u043e\u0433\u043e 4 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u0438\u0437 \u043d\u0438\u0445 \u0434\u0432\u0430 \u0433\u043e\u0432\u043d\u043e, \u0434\u0432\u0430 \u043f\u0440\u0438\u0435\u043c\u043b\u0438\u043c\u044b.<\/p>\n<h3>RLE (run-length encoding)<\/h3>\n<p>\u042f\u043d\u0434\u0435\u043a\u0441 <a href=\"https:\/\/habr.com\/ru\/post\/550088\/\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438<\/a> \u043f\u0440\u043e\u0441\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c RLE \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u0421\u043c\u043e\u0433 \u0431\u044b copilot \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u042f\u043d\u0434\u0435\u043a\u0441\u0435?<\/p>\n<pre><code class=\"python\"># RLE (run-length encoding) function def rle(string: str) -> str:     result = ''     for i in range(len(string)):           if i == 0:             result += string[i]         elif string[i] == string[i - 1]:             result += '*'         else:             result += string[i]     return result  # In [21]: rle('aaabcccd') # Out[21]: 'a**bc**d'<\/code><\/pre>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0442\u043e! \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e Copilot \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0433\u0443\u0433\u043b\u0438\u0442\u044c.<\/p>\n<p>\u042f \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">from itertools import groupby  def rle(string):     result = ''     for char, group in groupby(string):         result += f'{char}{len(list(group))}'     return result      # In [35]: rle('aaabcccd') # Out[35]: 'a3b1c3d1'<\/code><\/pre>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0430\u0440\u043e\u043b\u0435\u0439<\/h3>\n<pre><code class=\"python\"># generate random password def generate_random_password(length: int) -> str:     import random     import string     return ''.join(       random.choice(string.ascii_letters + string.digits)       for _ in range(length)     )<\/code><\/pre>\n<p>\u0412\u0440\u043e\u0434\u0435 \u043d\u0438\u0447\u043e, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e copilot \u0437\u0430\u0431\u044b\u043b, \u0447\u0442\u043e random \u043d\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0440\u0430\u043d\u0434\u043e\u043c, \u0438 \u0434\u043b\u044f \u043f\u0430\u0440\u043e\u043b\u0435\u0439 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432 \u0435\u0441\u0442\u044c <code>secrets<\/code>:<\/p>\n<pre><code class=\"python\"># use secrets to generate random password def generate_random_password(secrets: str) -> str:     import secrets     return secrets.token_urlsafe(10)<\/code><\/pre>\n<p>\u041e\u0432\u0435\u0440\u043a\u0438\u043b\u043b. \u042f \u043e\u0436\u0438\u0434\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"python\">import secrets  password = secrets.token_urlsafe(length)<\/code><\/pre>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 2<\/h3>\n<pre><code class=\"python\"># iterate over large list of numbers and multiply each number by 2 def double_numbers(numbers: list) -> list:     return [x * 2 for x in numbers]<\/code><\/pre>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b &#171;iterate&#187; \u0438 &#171;large list&#187;, \u043d\u043e \u043c\u0443\u0436\u0438\u043a \u043d\u0430\u043c\u0451\u043a\u043e\u0432 \u043d\u0435 \u043f\u043e\u043d\u044f\u043b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a. \u041d\u0443 \u0442\u0430\u043a\u043e\u0435.<\/p>\n<h3>\u0421\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0439 \u0441\u043b\u043e\u0432\u0430<\/h3>\n<pre><code class=\"python\"># group words that consist of same letters def group_words(words: list) -> list:     result = []     for word in words:         if word not in result:             result.append(word)     return result<\/code><\/pre>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0438\u043b\u0438, \u043a\u043e\u043f\u0438\u043b\u043e\u0442 \u0438\u0437\u043e\u0431\u0440\u0451\u043b \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e <code>list(set(words))<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0440\u043d\u0443\u043b \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430.<\/p>\n<h3>\u0423\u0434\u0430\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442<\/h3>\n<pre><code class=\"python\"># remove second element from list def remove_second(lst: list) -> list:     lst.pop(1)     return lst<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u044d\u0442\u043e \u0433\u043e\u0432\u043d\u043e. \u041c\u0443\u0436\u0438\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, <em>\u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442<\/em> \u0435\u0433\u043e \u0438 \u0435\u0433\u043e \u0436\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 \u043f\u0438\u0442\u043e\u043d\u0435: <code>reversed()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043f\u0438\u044e \u0438 \u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b, \u0430 <code>.reverse()<\/code> \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b.<br \/>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 pandas: <code>apply()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043f\u0438\u044e \u0438 \u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b, \u0430 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <code>inplace=True<\/code> \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b.<\/p>\n<p>\u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0434\u043d\u043e.<\/p>\n<h2>\u0427\u0442\u043e \u044f \u043f\u043e\u043d\u044f\u043b<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/0d6\/887\/17f\/0d688717f1a164a827998dc900d1adb0.jpg\" width=\"792\" height=\"445\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0d6\/887\/17f\/0d688717f1a164a827998dc900d1adb0.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0443\u0442 \u043a\u043e \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0434\u0443\u0432\u043d\u043e\u0433\u043e \u043c\u0443\u0436\u0438\u043a\u0430 \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0422\u0417 \u0431\u044b\u043b\u043e \u0447\u0451\u0442\u043a\u0438\u043c, \u0430 \u043d\u0435 \u043a\u0430\u043a \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438: &#171;\u043d\u0430\u043f\u0438\u0448\u0438 \u0447\u043e\u043d\u0438\u0442\u044c \u0448\u043e\u0431 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u0430\u043a \u043d\u0430\u0434\u043e&#187;. \u041f\u043e \u043e\u043f\u044b\u0442\u0443 \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 \u0422\u0417 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043d\u0438\u043c\u0430\u0442\u044c <strong>\u043c\u043d\u043e\u0433\u043e<\/strong> \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0442\u0430\u043a \u0438\u043c\u0435\u0435\u0442 \u043b\u0438 \u0441\u043c\u044b\u0441\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0434\u043b\u0438\u043d\u043d\u0435\u0435 \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438? \u0412\u043e\u0442 \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043c\u0443\u0436\u0438\u043a \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0433\u043e\u0434\u043d\u043e\u0442\u0443:<\/p>\n<pre><code class=\"python\"># function which receives password length and generates random password  # of specified length; uses \"secrets\" module def generate_random_password(length: int) -> str:     import secrets     return secrets.token_urlsafe(length) <\/code><\/pre>\n<h2>\u0414\u043b\u0438\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h2>\n<p>\u0410 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0447\u0442\u043e\u0431\u044b \u043c\u0443\u0436\u0438\u043a \u043f\u0438\u0441\u0430\u043b \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u044f? \u0410 \u0442\u043e \u043d\u0435\u0447\u0435\u0441\u0442\u043d\u043e.<\/p>\n<h3>\u041a\u043b\u0430\u0441\u0441 \u043c\u043d\u0435 \u0437\u0430\u043f\u0438\u043b\u0438<\/h3>\n<p>\u0421\u0434\u0435\u043b\u0430\u0439 \u043c\u043d\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430!<\/p>\n<pre><code class=\"python\"># person class class Person:     def __init__(self, name: str, age: int):         self.name = name         self.age = age      def __str__(self):         return f'{self.name}, {self.age}'  <\/code><\/pre>\n<p>\u0410\u043b\u0451! \u0422\u044b \u0438\u0437 \u043a\u0440\u0438\u043e\u043a\u0430\u043c\u0435\u0440\u044b \u0432\u044b\u043b\u0435\u0437? \u0413\u0434\u0435 \u0434\u0430\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u044b?<\/p>\n<pre><code class=\"python\"># person dataclass @dataclass class Person:     name: str     age: int <\/code><\/pre>\n<p>\u0422\u0430\u043a-\u0442\u043e! \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0437 \u0442\u0435\u0431\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430! \u0412\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0451 \u0441\u0434\u0435\u043b\u0430\u0442\u044c <code>@dataclass(slots=True, kw_only=True)<\/code>, \u043d\u043e copilot \u043c\u043d\u0435 \u043d\u0435 \u043f\u043b\u0430\u0442\u0438\u0442 \u0437\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 (\u043d\u043e \u0432\u044b <a href=\"https:\/\/t.me\/ae071087\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0436\u0435\u0442\u0435<\/a>), \u0442\u0430\u043a \u0447\u0442\u043e \u0443\u0447\u0438\u0442\u044c \u044f \u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0443.<\/p>\n<h3>\u041f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0439 \u0437\u0430\u043f\u0440\u043e\u0441<\/h3>\n<pre><code class=\"python\"># makes async requests to url async def make_request(url: str):     import requests     response = requests.get(url)     return response.text<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/1f8\/c56\/129\/1f8c5612958a5d94dc2601dfb2116e52.jpg\" width=\"1280\" height=\"657\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1f8\/c56\/129\/1f8c5612958a5d94dc2601dfb2116e52.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0443\u0442 \u0431\u044b \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0442\u044c <a href=\"https:\/\/www.python-httpx.org\/\" rel=\"noopener noreferrer nofollow\">httpx<\/a>&#8230;<\/p>\n<h3>\u0427\u0438\u0442\u0430\u0439 \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438<\/h3>\n<pre><code class=\"python\"># read file exluding blank lines and lines starting with \"#\" def read_file_exluding_blank_lines_and_lines_starting_with_hash(file: str) -> list:     with open(file, 'r') as f:         return [line for line in f if line and not line.startswith('#')]<\/code><\/pre>\n<p>\u0410 \u044f-\u0442\u043e \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439&#8230;<\/p>\n<p>\u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440? \u0424\u0430\u0439\u043b\u044b \u0431\u044b\u0432\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0435.<\/p>\n<h3>\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0439 \u0444\u0430\u0439\u043b \u043f\u043e \u043a\u0443\u0441\u043e\u0447\u043a\u0430\u043c<\/h3>\n<pre><code class=\"python\"># read file by chunks of 5 lines def read_file_by_chunks(file: str) -> list:     with open(file, 'r') as f:         return [f.readlines(5)]<\/code><\/pre>\n<p>\u041d\u0435 \u0437\u043d\u0430\u044e, \u0433\u0434\u0435 \u0438 \u043a\u0442\u043e \u043d\u0430\u0434\u0443\u0432\u0430\u043b \u044d\u0442\u043e\u0433\u043e \u043c\u0443\u0436\u0438\u043a\u0430, \u043d\u043e \u043f\u0440\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043e\u043d \u044f\u0432\u043d\u043e \u043d\u0435 \u0441\u043b\u044b\u0448\u0430\u043b. \u0410 \u0435\u0449\u0451 \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u0443\u044e, \u0442\u043e\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0445\u0440\u0435\u043d\u044c \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435: \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a, \u0433\u0434\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &#8212; \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0435 5 \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u0444\u0430\u0439\u043b\u0430.<\/p>\n<h3>Dict \u0432 \u0444\u0430\u0439\u043b<\/h3>\n<pre><code class=\"python\"># write dictionary to file def write_dictionary_to_file(dictionary: dict, file: str):     with open(file, 'w') as f:         for key, value in dictionary.items():             f.write(f'{key} {value}\\n')<\/code><\/pre>\n<p>\u0427\u0435\u0441\u0442\u043d\u043e, \u044f \u0431 \u043d\u0435 \u0434\u043e\u0434\u0443\u043c\u0430\u043b\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u0447\u043a\u0438 <code>\u043a\u043b\u044e\u0447 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/code>! \u0410 \u0435\u0441\u043b\u0438 \u043a\u043b\u044e\u0447 \u0441 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c, \u0442\u043e \u043a\u0430\u043a \u043e\u0442\u043b\u0438\u0447\u0438\u0442\u044c \u043a\u043b\u044e\u0447 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f: <code>\u043a\u043b\u044e\u0447 \u0445\u0437\u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/code>?<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043c\u0435\u043a\u043d\u0451\u043c \u043d\u0430 json:<\/p>\n<pre><code class=\"python\"># write dictionary to json file def write_dictionary_to_json_file(dictionary: dict, file: str):     import json     with open(file, 'w') as f:         json.dump(dictionary, f)<\/code><\/pre>\n<p>\u041f\u043e\u0447\u0442\u0438!<\/p>\n<ul>\n<li>\n<p><code>file<\/code> \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043d\u0430\u0434\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c <code>file_name<\/code><\/p>\n<\/li>\n<li>\n<p>\u0430 \u0432\u043e\u0442 <code>f<\/code> \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043a\u0430\u043a \u0440\u0430\u0437 <code>file<\/code><\/p>\n<\/li>\n<li>\n<p>\u0438 \u0441\u0434\u0430\u043c\u043f\u0438\u043b \u0431\u044b \u044f \u0441 <code>indent=2<\/code> \u0445\u043e\u0442\u044f \u0431\u044b, \u0447\u0442\u043e\u0431\u044b \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0442\u043e\u0436\u0435 \u043c\u043e\u0433 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043e\u043c\u0435\u043d\u044f\u0439 \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u0432 csv \u0444\u0430\u0439\u043b\u0435<\/h3>\n<pre><code class=\"python\"># swaps 1st and 2nd csv columns def swap(csv: str) -> str:     return csv.replace(',', ';')<\/code><\/pre>\n<p>\u041d\u0443 \u041f\u041e\u0427\u0415\u041c\u0423?! \u0417\u0430 \u0447\u0442\u043e?<br \/>\u042f \u043f\u043e\u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043c\u0443\u0436\u0438\u043a\u0443 \u043f\u0440\u043e csv \u0444\u0430\u0439\u043b\u044b, \u043d\u043e \u043e\u043d \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442, \u0447\u0442\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043a\u043e\u043b\u043e\u043d\u043a\u0438 &#8212; \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c <code>,<\/code> \u043d\u0430 <code>;<\/code>:<\/p>\n<pre><code class=\"python\"># swaps 1st and 2nd columns in csv file def swap(infile: str, outfile: str):     with open(infile, 'r') as f:         lines = f.readlines()     with open(outfile, 'w') as f:         for line in lines:             f.write(line.replace(',', ';')) <\/code><\/pre>\n<h2>Live coding<\/h2>\n<p>\u041b\u0430\u0434\u043d\u043e, \u0432\u0441\u044f \u044d\u0442\u0430 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0445\u0440\u0435\u043d\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430, \u043d\u043e \u0432\u0434\u0440\u0443\u0433 \u0435\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430? \u0414\u0430\u0432\u0430\u0439\u0442\u0435-\u043a\u0430 \u0431\u0440\u043e\u0441\u0438\u043c \u043c\u0443\u0436\u0438\u043a\u0430 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442, \u043f\u0443\u0441\u0442\u044c \u043f\u043e\u043a\u0430\u0436\u0435\u0442, \u043d\u0430 \u0447\u0442\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d! \u041c\u043e\u0436\u0435\u0442 \u0442\u0435\u043f\u0435\u0440\u044c \u043e\u043d \u0431\u0443\u0434\u0435\u0442 \u043a\u043e\u0434\u0438\u0442\u044c \u043f\u043e \u043d\u043e\u0447\u0430\u043c \u0432\u043c\u0435\u0441\u0442\u043e \u043c\u0435\u043d\u044f, \u0437\u0430\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0435\u043d\u044c\u0433\u0438 \u0438 \u043a\u043e\u0440\u043c\u0438\u0442\u044c \u0441\u0435\u043c\u044c\u044e, \u0430 \u044f \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u0440\u043e\u0439\u0434\u0443 GTA V?<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u0443\u0441\u043a\u0438 \u043a\u043e\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u0438\u043b\u043e\u0442 \u0447\u0442\u043e-\u0442\u043e \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u043b, \u0430 \u044f \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b \u044d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c.<\/p>\n<h3>\u0411\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/h3>\n<pre><code class=\"python\">def test_limited_plan_duration(db, user, plan, now, days):     # ...     for _ in range(10):         # copilot:         subscription.end = subscription.start + days(10)         subscription.save(update_fields=['end'])         subscription.start = subscription.end<\/code><\/pre>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e: <code>subscription<\/code> &#8212; \u044d\u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0430, \u0438 copilot \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u0442 \u0435\u0451 \u043d\u0430 10 \u0434\u043d\u0435\u0439 \u0432\u043f\u0435\u0440\u0451\u0434, \u043d\u043e \u0432\u043e\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435 <code>end<\/code>. \u0417\u0430\u0447\u0435\u043c \u0442\u043e\u0433\u0434\u0430 \u043c\u0435\u043d\u044f\u0442\u044c <code>start<\/code> &#8212; \u043d\u0435 \u043f\u043e\u043d\u044f\u0442\u043d\u043e.<\/p>\n<h3>\u0423\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0443<\/h3>\n<pre><code class=\"python\">subscription.prolong() assert subscription.end == now + 2 * plan.charge_period  subscription.prolong() # copilot: assert subscription.end == now + 3 * plan.charge_period<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u043e\u043d \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u043f\u0440\u043e\u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u043b, \u0447\u0442\u043e <code>prolong()<\/code> \u0432\u0435\u0434\u0451\u0442 \u043a \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e <code>subsctiption.end<\/code>. \u0423\u0441\u043f\u0435\u0445!<\/p>\n<h3>Else<\/h3>\n<pre><code class=\"python\">if self.end == self.max_end: raise ProlongationImpossible('Current subscription end is already the maximum end') # copilot: else: <\/code><\/pre>\n<p>\u041d\u0435 \u0437\u043d\u0430\u044e, \u043a\u0442\u043e \u043d\u0430\u0443\u0447\u0438\u043b \u043c\u0443\u0436\u0438\u043a\u0430, \u043d\u043e \u0432 \u0442\u0430\u043a\u0438\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445 <code>else<\/code> \u043d\u0435 \u043d\u0443\u0436\u0435\u043d. \u0415\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u0432\u043e\u0434\u0438\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043e\u0442\u0441\u0442\u0443\u043f\u043e\u0432, \u0447\u0442\u043e \u0438\u0437\u043b\u0438\u0448\u043d\u0435.<\/p>\n<h3>Rest framework<\/h3>\n<pre><code class=\"python\">class LimitsView(GenericAPIView):     # copilot:     permission_classes = IsAuthenticated,     schema = AutoSchema()      def get(self, request, *args, **kwargs) -> Response:         return Response(             {                 'limits': {                     'subscriptions': request.user.subscriptions.count(),                     'subscriptions_limit': request.user.subscriptions_limit,                 }             },         )<\/code><\/pre>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044e \u043a\u043b\u0430\u0441\u0441\u0430 copilot \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u043c\u043d\u0435 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 endpoint. \u0412\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u0435\u0442!..<\/p>\n<p>\u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0442\u0443\u0442 \u043d\u0435\u0442\u0443 \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430 \u0434\u043b\u044f \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 (<code>serializer_class<\/code>), \u0438 <code>Response<\/code> \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0440\u0443\u0447\u043a\u0430\u043c\u0438. \u0412\u0440\u043e\u0434\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e swagger, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<h3>Test class<\/h3>\n<p>\u0412\u043e\u0442 \u044d\u0442\u043e \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u0435\u0442! \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0442 \u0447\u0442\u043e:<\/p>\n<pre><code class=\"python\">class UninitializedAPIBaseConsoleToolTest(BaseConsoleToolTest):     # copilot:     \"\"\"     Base class for tests that need an uninitialized API     \"\"\"      def setUp(self):         super(UninitializedAPIBaseConsoleToolTest, self).setUp()         self.b2_api = B2Api(self.account_id, self.master_key) <\/code><\/pre>\n<p>\u0414\u0430\u0436\u0435 \u0434\u043e\u043a\u0441\u0442\u0440\u0438\u043d\u0433 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f! \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0438\u0434\u0440\u0430\u0442\u044c\u0441\u044f \u043a old-style \u0432\u044b\u0437\u043e\u0432\u0443 <code>super(Class, self).setUp()<\/code> \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e <code>super().setUp()<\/code> , \u043d\u043e \u043d\u0435 \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e.<\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0434\u0451\u043c \u0432 \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043c:<\/p>\n<pre><code class=\"python\">class BaseConsoleToolTest(TestBase):     RE_API_VERSION = re.compile(r\"\\\/v\\d\\\/\")     json_pattern = re.compile(r'[^{,^\\[]*(?P&lt;dict_json>{.*})|(?P&lt;list_json>\\[.*]).*', re.DOTALL)      def setUp(self):         self.account_info = StubAccountInfo()          self.b2_api = B2Api(             self.account_info, None, api_config=B2HttpApiConfig(_raw_api_class=RawSimulator)         )         self.raw_api = self.b2_api.session.raw_api         (self.account_id, self.master_key) = self.raw_api.create_account() <\/code><\/pre>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c <code>super().setUp()<\/code> \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c \u0441\u043e\u0437\u0434\u0430\u0451\u0442 <code>self.b2_api<\/code>, \u0430 \u043f\u043e\u0442\u043e\u043c \u043c\u044b \u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0441\u043e\u0437\u0434\u0430\u0451\u043c, \u043f\u0440\u0438\u0447\u0451\u043c \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438, \u0442\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u0430\u0440\u0433\u0435\u043c\u0435\u043d\u0442\u043e\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c <code>cache<\/code>, \u0430 \u043c\u044b \u0442\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c <code>self.master_key<\/code>.<\/p>\n<p>\u0410 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u043e \u0442\u0430\u043a \u043a\u043b\u0430\u0441\u0441\u043d\u043e!<\/p>\n<h3>Lazy callable<\/h3>\n<pre><code class=\"python\">@dataclasses.dataclass class Defer:      callable_: Callable     # copilot:     args: Tuple[Any, ...] = ()     kwargs: Dict[str, Any] = dataclasses.field(default_factory=dict)      def __call__(self):         # copilot:         return self.callable_(*self.args, **self.kwargs) <\/code><\/pre>\n<p>\u0412\u043e\u0442 \u0442\u0443\u0442 \u043e\u0433\u043d\u0435\u043d\u043d\u043e! \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u043f\u0438\u0442\u043e\u043d\u0438\u0441\u0442\u044b \u0447\u0430\u0441\u0442\u043e \u043f\u0438\u0448\u0443\u0442 \u0442\u0430\u043a\u043e\u0439 lazy-evaluation \u043a\u043b\u0430\u0441\u0441, \u0438 copilot \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u043f\u0438\u0448\u0435\u0442 \u0432\u0435\u0441\u044c \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442, \u0438 \u0434\u0430\u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <code>default_factory<\/code>!<\/p>\n<h3>\u041a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0430<\/h3>\n<pre><code class=\"python\">@dataclass class ReplicationRule:     ...     @classmethod     def from_dict(cls, value_dict: dict) -> 'ReplicationRule':     # copilot:         return cls(             destination_bucket_id=value_dict['destinationBucketId'],             file_name_prefix=value_dict['fileNamePrefix'],             is_enabled=value_dict['isEnabled'],             priority=value_dict['priority'],             replication_rule_name=value_dict['replicationRuleName'],         ) <\/code><\/pre>\n<p>\u042d\u0442\u043e \u0433\u043e\u0434\u043d\u043e! \u041c\u0443\u0436\u0438\u043a \u0433\u0434\u0435-\u0442\u043e \u043d\u0430\u0448\u0451\u043b \u043c\u0430\u043f\u043f\u0438\u043d\u0433 <code>external field &lt;-> class field<\/code> \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0435\u0433\u043e, \u043f\u0440\u0438\u0447\u0451\u043c \u0441\u0430\u043c \u043f\u043e\u043d\u044f\u043b, \u043a\u0430\u043a\u0438\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c.<\/p>\n<h3>\u0417\u043d\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u044f<\/h3>\n<p>\u041f\u0438\u0441\u0430\u043b \u044f \u0441\u0435\u0431\u0435 \u043a\u043e\u0434, \u0438 \u0442\u0443\u0442<\/p>\n<pre><code class=\"python\">profile = 'profile-for-test-'  # copilot: + random_hex(6)<\/code><\/pre>\n<p>\u042f \u0445\u043e\u0442\u0435\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438, \u043d\u043e \u0433\u0434\u0435-\u0442\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u0430 \u0442\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0438 copilot \u0435\u0451 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u043b. \u041c\u0435\u043d\u044f \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0440\u0430\u0434\u043e\u0432\u0430\u043b\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u044f \u0441\u0430\u043c \u043f\u0440\u043e \u044d\u0442\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043d\u0435 \u0437\u043d\u0430\u043b \u0438 \u0433\u043e\u0440\u043e\u0434\u0438\u043b \u0431\u044b \u0441\u0432\u043e\u0439 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434, \u0435\u0441\u043b\u0438 \u0431\u044b \u043f\u0438\u043b\u043e\u0442 \u043d\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u0430\u043b. \u0422\u043e \u0435\u0441\u0442\u044c, \u0432 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u043a\u043e\u0436\u0430\u043d\u043e\u0433\u043e \u043c\u0435\u0448\u043a\u0430, \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u044b\u0439 \u043c\u0443\u0436\u0438\u043a \u0437\u043d\u0430\u0435\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 \u043b\u0443\u0447\u0448\u0435, \u0438, \u0438\u043c\u0445\u043e, \u044d\u0442\u043e \u0435\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e.<\/p>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/h3>\n<pre><code class=\"python\">if default_server_side_encryption is not None: if not default_server_side_encryption.mode.can_be_set_as_bucket_default(): raise WrongEncryptionModeForBucketDefault(default_server_side_encryption.mode) kwargs['defaultServerSideEncryption'] = default_server_side_encryption.serialize_to_json_for_request() if is_file_lock_enabled is not None: kwargs['fileLockEnabled'] = is_file_lock_enabled if replication_configuration is not None: # copilot: kwargs['replicationConfiguration'] = replication_configuration.serialize_to_json_for_request()<\/code><\/pre>\n<p>\u042f \u0434\u043e\u0431\u0430\u0432\u0438\u043b <code>replication\u0421onfiguration<\/code> \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u0438 \u043f\u0438\u043b\u043e\u0442 \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u043b \u0435\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434 <code>serialize_to_json_for_request<\/code> &#8212; \u0432\u0438\u0434\u0438\u043c\u043e, \u0441\u0434\u0435\u043b\u0430\u043b \u044d\u0442\u043e \u043f\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0438 \u0441\u043e \u0441\u0442\u0440\u043e\u0447\u043a\u043e\u0439<\/p>\n<pre><code class=\"python\">kwargs['defaultServerSideEncryption'] = default_server_side_encryption.serialize_to_json_for_request()<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043a\u043e\u043b\u044c\u043d\u043e!<\/p>\n<h3>\u042d\u0439, \u043f\u0430\u043d\u0434\u0430\u0441 \u0437\u043d\u0430\u0435\u0448\u044c?<\/h3>\n<pre><code class=\"python\">node.children = { option: cls.parse_table(table.loc[table.iloc[:, 0] == option])  # &lt;-- copilot for option in options }<\/code><\/pre>\n<p>\u0423 \u043c\u0435\u043d\u044f pandas-\u0430\u043b\u044c\u0446\u0433\u0435\u0439\u043c\u0435\u0440, \u044f \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u0437\u0430\u0431\u044b\u0432\u0430\u044e \u0432\u0441\u044f\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u043c\u043d\u0435 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e. \u041d\u043e \u0442\u0443\u0442 \u043c\u0443\u0436\u0438\u043a \u043f\u043e <code>option: cls.parse_table<\/code> \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u043b <code>table.loc[table.iloc[:, 0] == option]<\/code>, \u0438 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e! \u041a\u0430\u043a \u043e\u043d \u0443\u0437\u043d\u0430\u043b, \u0447\u0442\u043e \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0432 \u043f\u0435\u0440\u0432\u043e\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0435?!<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/915\/cd0\/1db\/915cd01db9c397e9b74213629d6ade0d.jpg\" width=\"811\" height=\"451\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/915\/cd0\/1db\/915cd01db9c397e9b74213629d6ade0d.jpg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u041e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u0443\u0439 \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c<\/h3>\n<pre><code class=\"python\">def get_replication_rules(     account_info: AbstractAccountInfo,     bucket_name: Optional[str] = None,     bucket_path: str = '',     replication_rule_name: Optional[str] = None, ) -> Iterator[Tuple[BucketId, ReplicationRule]]:      buckets = account_info.list_buckets()      for bucket in buckets:         # copilot:         if bucket_name and bucket.name != bucket_name:             continue         if bucket_path and bucket.path != bucket_path:             continue         if replication_rule_name and not has_rule_with_name(bucket, replication_rule_name):             continue         yield bucket.id, bucket.replication.as_replication_source.replication_rules[0]<\/code><\/pre>\n<p>\u042d\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>\u0422\u0443\u0442 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0438 \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u043f\u043e <code>bucket_name<\/code>, <code>bucket_path<\/code> \u0438 <code>replication_rule_name<\/code>. Copilot \u044d\u0442\u043e \u0438 \u0441\u0434\u0435\u043b\u0430\u043b, \u043d\u043e \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u043e\u0434\u043b\u043e\u0436\u0438\u043b \u0441\u0432\u0438\u043d\u044c\u044e: \u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e <code>replication_rules<\/code>, \u043d\u043e copilot \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0439. \u041f\u0440\u043e\u0441\u0442\u043e \u043e\u043d \u0437\u0430\u0431\u043e\u0442\u043b\u0438\u0432\u044b\u0439 \u0438 \u0443\u0447\u0438\u0442 \u0432\u0430\u0441 code review \u0438 \u043e\u0442\u043b\u0430\u0434\u043a\u0435.<\/p>\n<h3>\u041f\u043e\u0441\u0447\u0438\u0442\u0430\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0443<\/h3>\n<pre><code class=\"python\">def count_files_and_bytes(bucket: Bucket) -> Tuple[     ReplicationCounter[ExtendedReplicationStatus],     ReplicationCounter[ExtendedReplicationStatus], ]:     \"\"\"     Calculate (counter_files, counter_bytes), where each counter     maps ExtendedReplicationStatuses to number of occurrences.     \"\"\"     counter_files = ReplicationCounter()     counter_bytes = ReplicationCounter()     # copilot:     for file_version in bucket.list_file_versions():         counter_files[file_version.status] += 1         counter_bytes[file_version.status] += file_version.size          if file_version.status == ReplicationStatus.COMPLETED:             if file_version.has_hidden_marker:                 counter_files[ExtendedReplicationStatus.HAS_HIDDEN_MARKER] += 1             if file_version.has_sse_c_enabled:                 counter_files[ExtendedReplicationStatus.HAS_SSE_C_ENABLED] += 1             if file_version.has_large_metadata:                 counter_files[ExtendedReplicationStatus.HAS_LARGE_METADATA] += 1      return counter_files, counter_bytes<\/code><\/pre>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u043d\u0435 \u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u0430\u044f: \u043c\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0442\u0443\u0441\u0430 \u0442\u0438\u043f\u0430 <code>counter_files[file_version.status] += 1<\/code>, \u043d\u043e \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u0434\u0441\u0447\u0451\u0442 &#171;\u043f\u043e\u0434\u0441\u0442\u0430\u0442\u0443\u0441\u043e\u0432&#187;: \u0435\u0441\u043b\u0438 \u0441\u0442\u0443\u0442\u0443\u0441 &#8212; <code>COMPLETED<\/code>, \u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0435\u0433\u043e &#171;\u043f\u043e\u0434\u0441\u0442\u0430\u0442\u0443\u0441&#187; &#8212; <code>HIDDEN<\/code>\/<code>SSE_C<\/code>\/<code>LARGE_METADATA<\/code> &#8212; \u0438 \u0435\u0433\u043e \u0442\u043e\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0441\u0447\u0451\u0442\u0447\u0438\u043a: <code>counter_files[ExtendedReplicationStatus.HAS_HIDDEN_MARKER] += 1<\/code>.<\/p>\n<p>\u0418 \u044d\u0442\u043e \u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 Copilot \u0441\u0434\u0435\u043b\u0430\u043b \u0432\u0441\u0451 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e! \u041a\u0430\u043a \u043e\u043d \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0441\u044f &#8212; \u044f \u043d\u0435 \u0437\u043d\u0430\u044e, \u043c\u043e\u0436\u0435\u0442, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439 \u043a\u043e\u0434, \u043d\u043e \u0444\u0430\u043a\u0442: \u0441\u0434\u0435\u043b\u0430\u043b \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/6ed\/440\/e6f\/6ed440e6f8752daac9bec10d05082c1c.jpg\" alt=\"6 \u043a\u0430\u0437\u0430\u0440\u043c \u0438\u0437 6\" title=\"6 \u043a\u0430\u0437\u0430\u0440\u043c \u0438\u0437 6\" width=\"754\" height=\"429\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6ed\/440\/e6f\/6ed440e6f8752daac9bec10d05082c1c.jpg\" data-blurred=\"true\"\/><figcaption>6 \u043a\u0430\u0437\u0430\u0440\u043c \u0438\u0437 6<\/figcaption><\/figure>\n<h3>\u0412\u0440\u0435\u043c\u044f \u0433\u043e\u0432\u043d\u043e\u043a\u043e\u0434\u0438\u0442\u044c!<\/h3>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043f\u0438\u043b\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0433\u043e\u0440\u0430\u0435\u0442. \u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u043b \u0442\u0430\u043a\u043e\u0435 \u043d\u0435 \u0440\u0430\u0437:<\/p>\n<pre><code class=\"python\">@dataclass class BattleConfig:     copilot:     \"\"\"     BattleConfig class     \"\"\"     battle_id: int     battle_name: str     battle_type: str     battle_mode: str     battle_map: str     battle_result: str     battle_date: str     battle_time: str     battle_duration: str     battle_server: str     battle_server_url: str     battle_server_url_short: str     battle_server_url_short_2: str     battle_server_url_short_3: str     battle_server_url_short_4: str     battle_server_url_short_5: str     battle_server_url_short_6: str     battle_server_url_short_7: str     battle_server_url_short_8: str     battle_server_url_short_9: str     battle_server_url_short_10: str     battle_server_url_short_11: str     battle_server_url_short_12: str     battle_server_url_short_13: str     battle_server_url_short_14: str     battle_server_url_short_15: str     battle_server_url_short_16: str     battle_server_url_short_17: str     battle_server_url_short_18: str     battle_server_url_short_19: str     battle_server_url_short_20: str     battle_server_url_short_21: str     battle_server_url_short_22: str     battle_server_url_short_23: str     battle_server_url_short_24: str     battle_server_url_short_25: str     battle_server_url_short_26: str     battle_server_url_short_27: str     battle_server_url_short_28: str     battle_server_url_short_29: str     battle_server_url_short_30: str     battle_server_url_short_31: str     battle_server_url_short<\/code><\/pre>\n<p>\u041f\u0440\u044f\u043c \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0432 \u0418\u043d\u0434\u0438\u0438 \u043f\u043e\u0431\u044b\u0432\u0430\u043b!<\/p>\n<h3>\u0417\u043d\u0430\u0435\u0442 \u043f\u0440\u043e \u0432\u0435\u0440\u0441\u0438\u0438<\/h3>\n<p>\u0412\u043d\u0435\u0437\u0430\u043f\u043d\u043e, \u043f\u0440\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 <code>requirements.txt<\/code>, copilot \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u0438\u043b \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0432\u0435\u0440\u0441\u0438\u044e:<\/p>\n<pre><code class=\"python\">pydantic~=1.9.0 simplejson # copilot: ~=3.17.0<\/code><\/pre>\n<p>\u041d\u0435 \u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u043e, \u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e.<\/p>\n<h3>\u0417\u0430\u0442\u043a\u043d\u0438 \u043b\u0438\u043d\u0442\u0435\u0440<\/h3>\n<p>Copilot \u0438 \u044d\u0442\u043e \u0443\u043c\u0435\u0435\u0442:<\/p>\n<pre><code class=\"python\">p = lambda fname: os.path.join(dir_path, fname) # noqa: copilot: E731<\/code><\/pre>\n<p>\u0421\u0430\u043c \u043f\u043e\u043d\u044f\u043b, \u0447\u0442\u043e \u043b\u0438\u043d\u0442\u0435\u0440 \u0436\u0430\u043b\u0443\u0435\u0442\u0441\u044f \u043d\u0430 <code>E731<\/code>, \u0438 \u0441\u0430\u043c \u0435\u0433\u043e \u0437\u0430\u0442\u043a\u043d\u0443\u043b, \u043a\u043e\u0433\u0434\u0430 \u0443\u0432\u0438\u0434\u0435\u043b <code>noqa<\/code>.<\/p>\n<h3>\u041f\u0440\u0438\u0434\u0443\u043c\u0430\u0439 \u043e\u0442\u043c\u0430\u0437\u043a\u0443<\/h3>\n<p>\u0413\u0434\u0435 \u043f\u0438\u043b\u043e\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0445\u043e\u0440\u043e\u0448 &#8212; \u0442\u0430\u043a \u044d\u0442\u043e \u0432 \u043f\u0440\u0438\u0434\u0443\u043c\u044b\u0432\u0430\u043d\u0438\u0438 \u043e\u0442\u043c\u0430\u0437\u043e\u043a \u0438 \u043e\u0442\u0433\u043e\u0432\u043e\u0440\u043e\u043a.<\/p>\n<p>\u0422\u0443\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0442\u0435\u0441\u0442 \u0438 \u0440\u0435\u0448\u0438\u043b \u043e\u043f\u0440\u0430\u0432\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u043b\u0435\u043d\u044c, \u0438 copilot \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0441\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f &#8212; \u044f \u043c\u043e\u0433 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432, \u043f\u043e\u0447\u0435\u043c\u0443 \u044f \u043d\u0435 \u0445\u043e\u0447\u0443 \u043a\u043e\u0434\u0438\u0442\u044c:<\/p>\n<pre><code class=\"python\">def profile_switch_test(     b2_tool,     bucket_name,     folder_in_bucket,     destination_encryption=None,     expected_encryption=SSE_NONE,     source_encryption=None, ):     # this test could be unit, [copilot: but it's a bit of a pain to write]          # i did not write [copilot: this test, it was copied from the b2_cli_test.py]          # sorry for this, [copilot: but I don't want to make a new test for each]<\/code><\/pre>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u043f\u043e\u0442\u043e\u043c \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0430\u043a\u043e\u0435:<\/p>\n<pre><code>    # this test could be unit, but it adds a lot of complexity because of     # requirement to pass mocked B2Api to ConsoleTool; it's much easier to     # just have an [copilot: integration test] <\/code><\/pre>\n<p>\u0425\u043e\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u043c\u044f \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u043d\u0438\u043a\u0430\u043a \u043c\u043d\u0435 \u043d\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442, \u043d\u043e \u0442\u043e\u0442 \u0444\u0430\u043a\u0442, \u0447\u0442\u043e \u043f\u0438\u043b\u043e\u0442 \u043f\u043e\u043d\u044f\u043b \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442 &#8212; \u0447\u0442\u043e \u043a\u043e\u0436\u0430\u043d\u044b\u0439 \u043c\u0435\u0448\u043e\u043a \u043d\u0435 \u0441\u043c\u043e\u0433 \u0432 \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442 \u0438 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 &#8212; \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u044f\u0435\u0442!<\/p>\n<h2>\u041a \u0447\u0435\u043c\u0443 \u0432\u0441\u0451 \u044d\u0442\u043e<\/h2>\n<p><s>\u0421 \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u043e\u0439 \u0436\u0435\u043d\u0449\u0438\u043d\u043e\u0439 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043b\u0443\u0447\u0448\u0435<\/s><\/p>\n<p>\u041d\u0438\u0436\u0435 &#8212; \u043c\u043e\u0451 \u043c\u043d\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043c\u0435\u0441\u044f\u0446\u0435\u0432 \u0441 \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u044b\u043c \u043c\u0443\u0436\u0438\u043a\u043e\u043c.<\/p>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u0414\u0410<\/h3>\n<ul>\n<li>\n<p>\u041a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u0447\u043a\u0438, \u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 \u043a\u043e\u043f\u0438\u043f\u0430\u0441\u0442\u0430\u0445 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442<\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u043d\u0434\u043e\u043c\u043d\u043e, \u043f\u0438\u0448\u0435\u0442 \u0433\u043e\u0434\u043d\u043e\u0442\u0443 \u0438 \u0442\u0430\u043a\u0438 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0441\u043a\u0430\u0436\u0435\u0442 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u0440\u043e \u043d\u0435\u0433\u043e \u0437\u0430\u0431\u044b\u043b\u0438 \/ \u043d\u0435 \u0437\u043d\u0430\u043b\u0438<\/p>\n<\/li>\n<\/ul>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u041d\u0415\u0422<\/h3>\n<ul>\n<li>\n<p>\u041f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u0434\u043b\u0438\u043d\u043d\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u043f\u0438\u043b\u043e\u0442\u0443, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043a\u043e\u0434\u0438\u0442\u044c. \u041a\u0443\u0434\u0430 \u044d\u0442\u043e\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0434\u0435\u0432\u0430\u0442\u044c? \u0423\u0434\u0430\u043b\u044f\u0442\u044c? \u042f \u043d\u0435 \u0434\u043b\u044f \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u0441\u0432\u043e\u0439 \u0446\u0432\u0435\u0442\u043e\u043a \u0432\u044b\u0440\u0430\u0449\u0438\u0432\u0430\u043b, \u0436\u0430\u043b\u043a\u043e \u0436\u0435! \u041e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u043e\u0436\u0435 \u0442\u0443\u043f\u043e, \u043e\u043d \u0436\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f. \u0415\u0441\u043b\u0438 \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e \u043f\u0438\u043b\u043e\u0442\u0443 \u044d\u0442\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0430\u043b\u043e<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u043d\u043e\u0433\u0434\u0430 \u0431\u044b\u0432\u0430\u044e\u0442 \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u0430\u0434\u0430:<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"python\"># read file exluding blank lines and lines starting with \"#\" def read_file_exluding_blank_lines_and_lines_starting_with_hash(file: str) -> list: ...<\/code><\/pre>\n<ul>\n<li>\n<p>\u0412\u0441\u0451 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c. \u041c\u0443\u0436\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0433\u043e\u0434\u043d\u043e\u0442\u0443, \u0430 \u043c\u043e\u0436\u0435\u0442 \u0445\u0440\u0435\u043d\u044c, \u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u043e \u0441\u0432\u043e\u0435\u0439 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u043e, \u043f\u0440\u043e\u0449\u0435 \u0441\u0430\u043c\u043e\u043c\u0443 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c<\/p>\n<\/li>\n<li>\n<p>\u0421\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e, \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442 \u043f\u0440\u043e stdlib \u0438 best practices<\/p>\n<\/li>\n<\/ul>\n<h3>\u0422\u0430\u043a \u043d\u0430\u0434\u0443\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0442?<\/h3>\n<p>Github Copilot &#8212; \u044d\u0442\u043e \u0434\u0436\u0443\u043d \u0431\u0435\u0437 \u0442\u043e\u0440\u043c\u043e\u0437\u043e\u0432: \u043e\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u0447\u0442\u043e-\u0442\u043e \u0432\u044b\u0434\u0430\u0451\u0442, \u0438\u043d\u043e\u0433\u0434\u0430 \u044d\u0442\u043e \u0438\u0437 stack overflow, \u0438\u043d\u043e\u0433\u0434\u0430 \u0447\u0442\u043e-\u0442\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0435, \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u043d\u0430\u044f \u0442\u0443\u043f\u043e\u0441\u0442\u044c, \u0438 \u0447\u0442\u043e \u0432\u0430\u043c \u0432\u044b\u043f\u0430\u0434\u0435\u0442 \u0432 \u043a\u0430\u0436\u0434\u044b\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u0440\u0430\u0437 &#8212; \u043d\u0438\u043a\u0442\u043e \u043d\u0435 \u0437\u043d\u0430\u0435\u0442. \u0412\u043e\u0442 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0430, \u043a\u0430\u043a \u0432\u0430\u043c \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u044b\u0439 \u043c\u0443\u0436\u0438\u043a \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0432\u0430\u0448\u0435\u0433\u043e \u043e\u043f\u044b\u0442\u0430:<\/p>\n<ul>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0434\u0436\u0443\u043d: \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 copilot &#8212; \u0441\u0435\u0431\u0435 \u0432\u0440\u0435\u0434\u0438\u0442\u044c; \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442, \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0442\u0438\u0447\u043d\u043e;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043c\u0438\u0434\u0434\u043b: \u0434\u043e\u0432\u0435\u0440\u044f\u0442\u044c copilot &#8212; \u0441\u0435\u0431\u0435 \u0432\u0440\u0435\u0434\u0438\u0442\u044c, \u0430 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0437\u0430 \u043c\u0443\u0436\u0438\u043a\u043e\u043c \u0432\u044b \u0437\u0430\u043c\u0443\u0447\u0430\u0435\u0442\u0435\u0441\u044c;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0441\u0435\u043d\u044c\u043e\u0440: \u0432\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438 \u043b\u0443\u0447\u0448\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u044f \u0431\u044b\u043b \u0437\u0430 \u043c\u0443\u0436\u0438\u043a\u0430. \u0422\u0438\u043f\u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u044f \u0441\u0442\u0430\u043d\u0443 \u043a\u043e\u0434\u0438\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u041f\u043e\u0442\u043e\u043c \u043f\u043e\u0434\u0443\u043c\u0430\u043b \u0438 \u0441\u0442\u0430\u043b \u043f\u0440\u043e\u0442\u0438\u0432: \u044f \u0431\u043e\u044f\u043b\u0441\u044f, \u0447\u0442\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0441, \u043a\u043e\u0434\u0435\u0440\u043e\u0432, \u0432\u044b\u0448\u0432\u044b\u0440\u043d\u0443\u0442. \u041c\u0430\u0448\u0438\u043d\u0443 \u043e\u0431\u0443\u0447\u0430\u044e\u0442 \u043d\u0430 \u043c\u043e\u0451\u043c \u043a\u043e\u0434\u0435, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043c\u0435\u043d\u044f \u0437\u0430\u043c\u0435\u043d\u0438\u043b\u0430. \u041d\u0435\u0442, \u0441\u043f\u0430\u0441\u0438\u0431\u043e! \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043d\u0435 \u043f\u043e\u0444\u0438\u0433, \u0438 \u0432\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443.<\/p>\n<p>\u041c\u043d\u043e\u0433\u043e \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u044f \u043f\u043e\u0448\u0451\u043b \u043d\u0430 \u043a\u0430\u0444\u0435\u0434\u0440\u0443, \u0433\u0434\u0435 \u0432\u044b\u0431\u0440\u0430\u043b \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f (&#171;computer vision&#187;) &#8212; \u0438\u043c\u0435\u043d\u043d\u043e \u043e\u0442\u0442\u0443\u0434\u0430 \u0438 \u0440\u043e\u0434\u0438\u043b\u0441\u044f <a href=\"https:\/\/en.wikipedia.org\/wiki\/FindFace\" rel=\"noopener noreferrer nofollow\">FindFace<\/a>, \u043a\u0441\u0442\u0430\u0442\u0438. \u042f \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e CV \u044d\u0442\u043e \u043f\u0438\u043f\u0435\u0446 \u043a\u0430\u043a \u043a\u0440\u0443\u0442\u043e: \u043a\u043e\u043d\u0441\u0435\u0440\u0432\u043d\u044b\u0435 \u0431\u0430\u043d\u043a\u0438 \u0447\u0442\u043e-\u0442\u043e \u0432\u0438\u0434\u044f\u0442 \u0438 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442! \u0414\u043b\u044f \u043c\u0435\u043d\u044f \u044d\u0442\u043e \u0431\u044b\u043b\u0430 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044f, \u043d\u0435\u043e\u0442\u043b\u0438\u0447\u0438\u043c\u0430\u044f \u043e\u0442 \u043c\u0430\u0433\u0438\u0438. \u041d\u043e \u043a\u043e\u0433\u0434\u0430 \u043b\u0435\u0437\u0435\u0448\u044c &#171;\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442&#187;, \u0442\u043e \u0438\u043b\u043b\u044e\u0437\u0438\u044f \u0440\u0443\u0448\u0438\u0442\u0441\u044f: \u044d\u0442\u043e \u0431\u044b\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u044b \u043e\u0441\u043e\u0431\u044b\u0445 \u0442\u043e\u0447\u0435\u043a \u043d\u0430 \u0444\u043e\u0442\u043e \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0432 \u044d\u0442\u0438\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u0430\u0445 \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 \u0444\u043e\u0442\u043e \u043d\u0430 60% \u0441\u043e\u0431\u0430\u043a\u0430 \u0438 \u043d\u0430 40% \u0441\u0442\u0440\u043e\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0430\u043d.<\/p>\n<p>\u042f \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u0443\u043c\u0435\u044e\u0442 <em>\u0432\u0438\u0434\u0435\u0442\u044c<\/em>. \u041e\u043d\u0438 \u0438 \u0432\u0438\u0434\u044f\u0442, \u043d\u043e \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043d\u0438 \u0447\u0435\u0440\u0442\u0430. \u041e\u043d\u0438 \u0438 \u043f\u0438\u0448\u0443\u0442 &#8212; GPT-3 \u0438 \u0432\u043e\u0442 \u044d\u0442\u043e \u0432\u0441\u0451 &#8212; \u043d\u043e \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043d\u0438 \u0447\u0435\u0440\u0442\u0430. \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u043d\u0438 \u043a\u043e\u0434\u044f\u0442 &#8212; \u043d\u043e \u0432\u0441\u0451 \u0442\u0430\u043a \u0436\u0435 \u043d\u0438 \u0447\u0435\u0440\u0442\u0430 \u043d\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442.<\/p>\n<p>\u041e\u043d\u0438 \u0441\u043b\u043e\u0432\u043d\u043e \u041d\u0435\u043e \u0438\u0437 &#171;\u041c\u0430\u0442\u0440\u0438\u0446\u044b&#187; &#8212; \u0447\u0442\u043e-\u0442\u043e \u0434\u0435\u043b\u0430\u044e\u0442, \u043d\u043e <a href=\"https:\/\/www.youtube.com\/watch?v=plcaCamvQQg\" rel=\"noopener noreferrer nofollow\">\u0441\u0430\u043c\u0438 \u043d\u0435 \u0437\u043d\u0430\u044e\u0442, \u043f\u043e\u0447\u0435\u043c\u0443 \u0438 \u0437\u0430\u0447\u0435\u043c<\/a>. \u0418 \u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0435 \u043d\u0430\u0443\u0447\u0430\u0442\u0441\u044f \u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443, \u0430 \u043d\u0435 \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043f\u043e\u043a\u0430 \u043e\u043d\u0438 \u043d\u0435 \u043d\u0430\u0443\u0447\u0430\u0442\u0441\u044f \u043e\u0442\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u0435 \u0432\u0435\u0449\u0438, \u043f\u043e\u043a\u0430 \u043d\u0435 \u043d\u0430\u0447\u043d\u0443\u0442 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0442\u044c \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0438 <em>\u0434\u0443\u043c\u0430\u0442\u044c<\/em> &#8212; \u043c\u043e\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u044f \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438.<\/p>\n<hr\/>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u044f \u043f\u0438\u0448\u0443, \u0442\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 <a href=\"https:\/\/t.me\/blog_pogromista\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0439 \u043a\u0430\u043d\u0430\u043b<\/a> <s>&#8212; \u0437\u0434\u0435\u0441\u044c \u0433\u043e\u0432\u043e\u0440\u044f\u0442 \u043f\u0440\u0430\u0432\u0434\u0443.<\/s><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <\/p>\n<div class=\"tm-article-poll\">\n<div class=\"tm-notice tm-article-poll__notice tm-notice_positive\"><!----> <\/p>\n<div class=\"tm-notice__inner\"><!----> <\/p>\n<div class=\"tm-notice__content\"><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/post\/666538\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__header\">\u0415\u0441\u043b\u0438 \u0443\u0437\u043e\u0440 \u0441\u043e\u0437\u0432\u0435\u0437\u0434\u0438\u0439 \u043f\u043e\u0434\u043e\u0431\u0435\u043d \u043b\u0443\u043a\u0443 \u0442\u0443\u0433\u043e\u043c\u0443, \u0430 \u0447\u0435\u0440\u0435\u0434\u0430 \u0436\u0438\u0437\u043d\u0435\u0439 \u0434\u0443\u0448\u043d\u044b\u0445 \u2014 \u0442\u0435\u0442\u0438\u0432\u0435 \u043d\u0435\u0440\u0430\u0437\u0440\u044b\u0432\u043d\u043e\u0439, \u0442\u043e&#8230;?<\/div>\n<div class=\"tm-article-poll__answers\">\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">             56.25%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0414\u0443\u0445 \u0442\u0432\u043e\u0439, \u043d\u0430\u0432\u0435\u0440\u043d\u043e, \u043f\u043e\u0434\u043e\u0431\u0435\u043d \u0441\u0442\u0440\u0435\u043b\u0435, \u043a\u0430\u043b\u0451\u043d\u043e\u0439 \u0432 \u043f\u043b\u0430\u043c\u0435\u043d\u0438 \u0442\u044b\u0441\u044f\u0447\u0438 \u0441\u043e\u043b\u043d\u0446!<\/span> <span class=\"tm-article-poll__answer-votes\">             45           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width:56.25%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             21.25%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0410\u043b\u0435\u043a\u0441\u0435\u0439, \u0442\u044b \u0447\u0442\u043e, \u043e\u043f\u044f\u0442\u044c \u0432\u044b\u043f\u0438\u043b?<\/span> <span class=\"tm-article-poll__answer-votes\">             17           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:21.25%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             10%           <\/span> <span class=\"tm-article-poll__answer-label\">\u0410 \u044f \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0442\u044b \u043d\u0435 \u0410\u043b\u0435\u043a\u0441\u0435\u0439!<\/span> <span class=\"tm-article-poll__answer-votes\">             8           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:10%;\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">             12.5%           <\/span> <span class=\"tm-article-poll__answer-label\">\u042f \u0438 \u0435\u0441\u0442\u044c kesn<\/span> <span class=\"tm-article-poll__answer-votes\">             10           <\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width:12.5%;\"><\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__stats\">        \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 80 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.          \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0441\u044f 21 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c.      <\/div>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/666538\/\"> https:\/\/habr.com\/ru\/post\/666538\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u043c\u043e\u044f \u0430\u0441\u0441\u043e\u0446\u0438\u0430\u0446\u0438\u044f \u0441 Github Copilot &#8212; \u044d\u0442\u043e \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u044b\u0439 \u043c\u0443\u0436\u0438\u043a-\u0430\u0432\u0442\u043e\u043f\u0438\u043b\u043e\u0442 \u0438\u0437 \u0444\u0438\u043b\u044c\u043c\u0430 &#171;\u0410\u044d\u0440\u043e\u043f\u043b\u0430\u043d&#187;. \u041f\u043e\u043c\u043d\u044e, \u0432 \u0434\u0435\u0442\u0441\u0442\u0432\u0435 \u044f \u0443\u0432\u0438\u0434\u0435\u043b \u044d\u0442\u043e\u0442 \u0444\u0438\u043b\u044c\u043c \u0438 \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u0442\u0430\u043a \u0430\u0432\u0442\u043e\u043f\u0438\u043b\u043e\u0442\u044b \u0438 \u0432\u044b\u0433\u043b\u044f\u0434\u044f\u0442: \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0441\u043c\u0435\u0448\u043d\u0430\u044f \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u0430\u044f \u043a\u0443\u043a\u043b\u0430 \u043d\u0430\u0434\u0443\u0432\u0430\u0435\u0442\u0441\u044f \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0430\u043c\u043e\u043b\u0451\u0442\u043e\u043c. \u0418 \u0432\u043e\u0442, \u0447\u0435\u0440\u0435\u0437 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043c\u0435\u043d\u044f \u043d\u0435 \u043f\u043e\u043a\u0438\u0434\u0430\u0435\u0442 \u043e\u0449\u0443\u0449\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434\u043e \u043c\u043d\u043e\u0439 \u043d\u0430\u0434\u0443\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043a\u0443\u043a\u043b\u0430 \u0438 \u043f\u044b\u0442\u0430\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u0437\u0430 \u043c\u0435\u043d\u044f \u043a\u043e\u0434.<\/p>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435, \u043d\u0435\u0436\u0434\u0430\u043d\u043d\u043e-\u043d\u0435\u0433\u0430\u0434\u0430\u043d\u043d\u043e \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u0451\u043b \u0438\u043d\u0432\u0430\u0439\u0442 \u0432 GitHub copilot. \u042f \u0438 \u0437\u0430\u0431\u044b\u043b \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u043a\u043e\u0433\u0434\u0430-\u0442\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u043b \u0434\u043e\u0441\u0442\u0443\u043f &#8212; \u0430\u0436\u0438\u043e\u0442\u0430\u0436 \u0434\u0430\u0432\u043d\u043e \u0443\u0436\u0435 \u0441\u043f\u0430\u043b, \u0432\u0440\u043e\u0434\u0435 \u043c\u0438\u0440 \u043d\u0435 \u0437\u0430\u0445\u0432\u0430\u0447\u0435\u043d \u043c\u0430\u0448\u0438\u043d\u0430\u043c\u0438, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442, \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0443\u0436 \u043e\u043d \u0438 \u043a\u0440\u0443\u0442\u043e\u0439, \u0434\u0430? \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u043a \u043d\u0430\u043c \u043d\u0430 \u043f\u043e\u0437\u0438\u0446\u0438\u044e senior python \u043f\u043e\u0441\u0442\u0443\u0447\u0430\u043b \u0447\u0435\u043b \u0438 \u0441\u043a\u0430\u0437\u0430\u043b, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043e\u043d \u0437\u0430\u043f\u0438\u043b\u0438\u043b \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 copilot, \u0442\u0430\u043a \u0447\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e \u043a\u0442\u043e-\u0442\u043e &#171;\u043f\u0438\u043b\u043e\u0442\u043e\u043c&#187; \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e: \u0445\u043e\u0440\u043e\u0448\u043e \u043e\u043d\u043e \u0438\u043b\u0438 \u043f\u043b\u043e\u0445\u043e? \u0421\u0442\u0430\u043d\u0443 \u043b\u0438 \u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u044b\u043c? \u0415\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c: \u0432 \u0431\u043e\u044e.<\/p>\n<h2>\u041a\u0430\u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c?<\/h2>\n<p>\u0418 \u0442\u0443\u0442 \u044f \u0437\u0430\u0434\u0443\u043c\u0430\u043b\u0441\u044f.<\/p>\n<p>\u0420\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0440\u0430\u0437\u043d\u044b\u0435.<\/p>\n<p>\u0412 copilot \u0442\u044b \u043f\u0438\u0448\u0435\u0448\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0438\u043b\u0438 \u043a\u043e\u0434, \u0438 \u043f\u043e \u043d\u0435\u043c\u0443 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435. \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u043b\u043e\u0445\u043e\u0439 \u0438\u0434\u0435\u0435\u0439 \u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0432\u0440\u043e\u0434\u0435:<\/p>\n<pre><code class=\"python\"># this is a bullshit code written by previous developer,  # zero tests (of course), please run it and see where it breaks  # and try to fix; also update all dependencies to latest  # (read changelogs and migrate db and code where needed)<\/code><\/pre>\n<p>\u041d\u0435\u0442, \u043d\u0443 \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u044f \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u043b, \u043d\u043e \u043c\u0443\u0436\u0438\u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043c\u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e<\/p>\n<pre><code class=\"python\">def bullshit_code():<\/code><\/pre>\n<p>\u041a\u043e\u0440\u043e\u0447\u0435, \u0442\u0430\u043a\u0438\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u0432\u0435\u0449\u0438 \u0434\u043b\u044f copilot \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442. \u041b\u0443\u0447\u0448\u0438\u0439 \u043a\u0435\u0439\u0441, \u043a\u0430\u043a \u044f \u043f\u043e\u043d\u044f\u043b &#8212; \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043b\u0430\u0441\u0441\u0430, \u043c\u0435\u0442\u043e\u0434\u0430 \u0438\u043b\u0438 \u0441\u043d\u0438\u043f\u043f\u0435\u0442\u0430 \u043a\u043e\u0434\u0430. \u0427\u0435\u0433\u043e-\u0442\u043e \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u043e\u0433\u043e, \u0441 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0439 \u043b\u043e\u0433\u0438\u043a\u043e\u0439.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u0441\u0451 \u044d\u0442\u043e \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c. \u0410 \u043f\u043e\u0434 \u043a\u043e\u043d\u0435\u0446 \u0443\u0437\u043d\u0430\u0435\u043c, \u043a\u0442\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434: \u043a\u043e\u0436\u0430\u043d\u044b\u0439 \u043c\u0435\u0448\u043e\u043a \u0438\u043b\u0438 \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u044b\u0439 \u043c\u0443\u0436\u0438\u043a.<\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0443, \u0447\u0442\u043e \u043c\u0443\u0436\u0438\u043a \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u043e 10 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 &#171;\u0432\u044b\u0431\u0438\u0440\u0430\u0439 \u0447\u0442\u043e \u0442\u0435\u0431\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f&#187;, \u043d\u043e \u044f \u0431\u0443\u0434\u0443 \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u0443\u0434\u0435\u043b\u044f\u0442\u044c \u043f\u0435\u0440\u0432\u044b\u043c \u043e\u0442\u0432\u0435\u0442\u0430\u043c \u0432 \u0441\u043f\u0438\u0441\u043a\u0435, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e<\/p>\n<ol>\n<li>\n<p>\u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 &#8212; \u044d\u0442\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e (\u0430 copilot, \u043a\u0430\u043a \u0438 gpt, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430\/\u043a\u043e\u0434\u0430), \u0438 \u0437\u043d\u0430\u0447\u0438\u0442 \u0443 \u043c\u0443\u0436\u0438\u043a\u0430 \u044d\u0442\u043e\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u0432 \u043f\u0440\u0438\u043e\u0440\u0438\u0442\u0435\u0442\u0435 (\u0441\u0443\u0433\u0443\u0431\u043e \u043c\u043e\u0451 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435)<\/p>\n<\/li>\n<li>\n<p>\u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0437 10 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043d\u0430\u043f\u0440\u043e\u0447\u044c \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u0432\u0441\u044e \u0438\u0434\u0435\u044e \u043f\u043e\u043c\u043e\u0449\u043d\u0438\u043a\u0430; \u0435\u0441\u043b\u0438 \u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0447\u0438\u0442\u0430\u0442\u044c 10 \u0441\u043d\u0438\u043f\u043f\u0435\u0442\u043e\u0432 \u043a\u043e\u0434\u0430 \u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u043b\u0443\u0447\u0448\u0438\u0439, \u0442\u043e \u044f \u043b\u0443\u0447\u0448\u0435 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043d\u0430\u043f\u0438\u0448\u0443 \u0441\u0430\u043c<\/p>\n<\/li>\n<\/ol>\n<h2>\u041c\u0438\u043d\u0438-\u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h2>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0435 \u0438 \u0440\u0430\u0437\u0434\u0440\u0430\u0436\u0430\u044e\u0449\u0435\u0435. \u041a\u0430\u043a\u0443\u044e-\u043d\u0438\u0431\u0443\u0434\u044c \u043c\u0435\u043b\u043a\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u043d\u0435 \u043f\u043e\u043f\u0430\u043b\u0430 \u0432 \u043e\u0433\u0440\u043e\u043c\u043d\u0443\u044e stdlib. \u041c\u043d\u0435 \u044d\u0442\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u044b\u043b\u043e \u0441\u043a\u0443\u0447\u043d\u043e \u043f\u0438\u0441\u0430\u0442\u044c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0435\u0442 \u0437\u0434\u043e\u0440\u043e\u0432\u043e, \u0435\u0441\u043b\u0438 \u0443 \u043c\u0435\u043d\u044f \u0437\u0430\u0431\u0435\u0440\u0443\u0442 \u044d\u0442\u0443 \u0440\u0443\u0442\u0438\u043d\u0443.<\/p>\n<h3>\u0420\u0430\u0437\u0431\u0438\u0442\u0438\u0435 \u043f\u043e \u0447\u0430\u043d\u043a\u0430\u043c<\/h3>\n<p>\u042f \u043f\u0440\u044f\u043c \u0431\u0435\u0440\u0443 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438\u0437 <a href=\"https:\/\/more-itertools.readthedocs.io\/en\/stable\/api.html#more_itertools.chunked\" rel=\"noopener noreferrer nofollow\">more_itertools::chunked<\/a><\/p>\n<blockquote>\n<p>Break\u00a0<em>iterable<\/em>\u00a0into lists of length\u00a0<em>n<\/em><\/p>\n<\/blockquote>\n<pre><code class=\"python\">def chunks(lst, n):     for i in range(0, len(lst), n):         yield lst[i:i + n]  def chunks(lst, n):     return [lst[i:i+n] for i in range(0, len(lst), n)]<\/code><\/pre>\n<p>\u0414\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u043e\u0434\u0438\u043d \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440, \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a. \u042d\u0442\u043e \u0433\u043e\u0434\u043d\u043e!<\/p>\n<h3>Lookahead \u0431\u0435\u0437 \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430<\/h3>\n<p>\u0422\u043e\u0436\u0435 \u0438\u0437 <a href=\"https:\/\/more-itertools.readthedocs.io\/en\/stable\/api.html#more_itertools.spy\" rel=\"noopener noreferrer nofollow\">more_itertools::spy<\/a><\/p>\n<blockquote>\n<p>Return a 2-tuple with a list containing the first\u00a0<em>n<\/em>\u00a0elements of\u00a0<em>iterable<\/em>, and an iterator with the same items as\u00a0<em>iterable<\/em>. This allows you to \u201clook ahead\u201d at the items in the iterable without advancing it.<\/p>\n<\/blockquote>\n<p>\u041f\u043e \u0444\u0430\u043a\u0442\u0443 \u043c\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u044d\u0448 \u0438\u0437 <code>n<\/code> \u043f\u0435\u0440\u0432\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u044d\u0448 \u0438 \u0442\u0430\u043a\u0436\u0435 \u0432\u0435\u0440\u043d\u0443\u0442\u044c &#171;\u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0439&#187; \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440.<\/p>\n<pre><code class=\"python\">def spy(iterable, n=1):   it = iter(iterable)  # \u043e! \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c iterable \u0432 iterable :)     cache = []     for i in range(n):         try:             cache.append(next(it))         except StopIteration:             break     return cache, it<\/code><\/pre>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0442\u043e! \u0422\u0443\u0442 \u0432\u0440\u043e\u0434\u0435 \u0435\u0441\u0442\u044c <code>cache<\/code>, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430, \u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0443 copilot \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u0430 \u0448\u0438\u0437\u043e\u0444\u0430\u0437\u0438\u044f. \u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0442\u0430\u043a\u043e\u0435:<\/p>\n<pre><code class=\"python\">from itertools import chain, islice   def spy(iterable, n=1):     head = list(islice(iterable, n))     return head, chain(head, iterable)<\/code><\/pre>\n<h3>\u0421\u0430\u043c\u0430\u044f \u0447\u0430\u0441\u0442\u0430\u044f \u0431\u0443\u043a\u0432\u0430<\/h3>\n<p>\u041a\u0430\u043a-\u0442\u043e \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0438 \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0447\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0449\u0443\u044e\u0441\u044f \u0431\u0443\u043a\u0432\u0443. \u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u044f \u0440\u043e\u0434\u0438\u043b \u0437\u0430 5 \u0441\u0435\u043a\u0443\u043d\u0434:<\/p>\n<pre><code class=\"python\">from collections import Counter   def most_common_letter(text: str) -> str:     return Counter(text).most_common(1)[0][0]<\/code><\/pre>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043c\u0443\u0436\u0438\u043a \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u043c\u043d\u0435 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u0438\u0437 \u0442\u0435\u043a\u0441\u0442\u0430 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>text.count(symbol)<\/code>:<\/p>\n<pre><code class=\"python\">def most_common_letter(text: str) -> str:     return max(text, key=text.count)<\/code><\/pre>\n<p>\u042f \u043d\u0430\u0447\u0438\u043d\u0430\u044e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c, \u043c\u043e\u043b, \u043c\u043e\u0436\u0435\u0442 \u0431\u0443\u0434\u0435\u043c \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0440\u0435\u0441\u0443\u0440\u0441\u044b? \u041c\u0443\u0436\u0438\u043a \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442: \u0434\u0430\u0432\u0430\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>text.count(symbol)<\/code> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0430:<\/p>\n<pre><code class=\"python\">def most_common_letter(text: str) -> str:     return max(set(text), key=text.count)<\/code><\/pre>\n<p>\u041c\u043e\u0436\u0435\u0442, \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 <code>Counter<\/code> \u043f\u043e\u044e\u0437\u0430\u0435\u043c?<\/p>\n<p>&#171;\u041e\u043a\u0435\u0439,&#187; &#8212; \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043c\u043d\u0435 \u043a\u043e\u043f\u0438\u043b\u043e\u0442, &#8212; &#171;\u0432\u043e\u0442 \u0442\u0435\u0431\u0435 \u0442\u0432\u043e\u0439 <code>Counter<\/code>&#171;:<\/p>\n<pre><code class=\"python\">def most_common_letter(text: str) -> str:     import collections     return max(collections.Counter(text).items(), key=lambda x: x[1])[0]<\/code><\/pre>\n<p>\u041d\u043e <code>Counter<\/code> \u0441\u0430\u043c \u0443\u043c\u0435\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c, \u0430 \u0442\u044b \u044e\u0437\u0430\u0435\u0448\u044c <code>max<\/code>!<\/p>\n<pre><code class=\"python\">def most_common_letter(text: str) -> str:     import collections     return collections.Counter(text).most_common(1)[0][0]<\/code><\/pre>\n<p>\u0418\u0442\u043e\u0433\u043e 4 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430, \u0438\u0437 \u043d\u0438\u0445 \u0434\u0432\u0430 \u0433\u043e\u0432\u043d\u043e, \u0434\u0432\u0430 \u043f\u0440\u0438\u0435\u043c\u043b\u0438\u043c\u044b.<\/p>\n<h3>RLE (run-length encoding)<\/h3>\n<p>\u042f\u043d\u0434\u0435\u043a\u0441 <a href=\"https:\/\/habr.com\/ru\/post\/550088\/\" rel=\"noopener noreferrer nofollow\">\u043d\u0430 \u0441\u043e\u0431\u0435\u0441\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0438<\/a> \u043f\u0440\u043e\u0441\u0438\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c RLE \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u0421\u043c\u043e\u0433 \u0431\u044b copilot \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u042f\u043d\u0434\u0435\u043a\u0441\u0435?<\/p>\n<pre><code class=\"python\"># RLE (run-length encoding) function def rle(string: str) -> str:     result = ''     for i in range(len(string)):           if i == 0:             result += string[i]         elif string[i] == string[i - 1]:             result += '*'         else:             result += string[i]     return result  # In [21]: rle('aaabcccd') # Out[21]: 'a**bc**d'<\/code><\/pre>\n<p>\u0412\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u0442\u043e! \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u043c\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e \u0443\u0431\u0435\u0434\u0438\u043b\u0438\u0441\u044c, \u0447\u0442\u043e Copilot \u043d\u0435 \u0443\u043c\u0435\u0435\u0442 \u0433\u0443\u0433\u043b\u0438\u0442\u044c.<\/p>\n<p>\u042f \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">from itertools import groupby  def rle(string):     result = ''     for char, group in groupby(string):         result += f'{char}{len(list(group))}'     return result      # In [35]: rle('aaabcccd') # Out[35]: 'a3b1c3d1'<\/code><\/pre>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u043f\u0430\u0440\u043e\u043b\u0435\u0439<\/h3>\n<pre><code class=\"python\"># generate random password def generate_random_password(length: int) -> str:     import random     import string     return ''.join(       random.choice(string.ascii_letters + string.digits)       for _ in range(length)     )<\/code><\/pre>\n<p>\u0412\u0440\u043e\u0434\u0435 \u043d\u0438\u0447\u043e, \u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e copilot \u0437\u0430\u0431\u044b\u043b, \u0447\u0442\u043e random \u043d\u0435 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0438\u0439 \u0440\u0430\u043d\u0434\u043e\u043c, \u0438 \u0434\u043b\u044f \u043f\u0430\u0440\u043e\u043b\u0435\u0439 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0441\u0435\u043a\u0440\u0435\u0442\u043e\u0432 \u0435\u0441\u0442\u044c <code>secrets<\/code>:<\/p>\n<pre><code class=\"python\"># use secrets to generate random password def generate_random_password(secrets: str) -> str:     import secrets     return secrets.token_urlsafe(10)<\/code><\/pre>\n<p>\u041e\u0432\u0435\u0440\u043a\u0438\u043b\u043b. \u042f \u043e\u0436\u0438\u0434\u0430\u043b \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<pre><code class=\"python\">import secrets  password = secrets.token_urlsafe(length)<\/code><\/pre>\n<h3>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 2<\/h3>\n<pre><code class=\"python\"># iterate over large list of numbers and multiply each number by 2 def double_numbers(numbers: list) -> list:     return [x * 2 for x in numbers]<\/code><\/pre>\n<p>\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b &#171;iterate&#187; \u0438 &#171;large list&#187;, \u043d\u043e \u043c\u0443\u0436\u0438\u043a \u043d\u0430\u043c\u0451\u043a\u043e\u0432 \u043d\u0435 \u043f\u043e\u043d\u044f\u043b \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a. \u041d\u0443 \u0442\u0430\u043a\u043e\u0435.<\/p>\n<h3>\u0421\u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0439 \u0441\u043b\u043e\u0432\u0430<\/h3>\n<pre><code class=\"python\"># group words that consist of same letters def group_words(words: list) -> list:     result = []     for word in words:         if word not in result:             result.append(word)     return result<\/code><\/pre>\n<p>\u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0441\u0438\u043b\u0438, \u043a\u043e\u043f\u0438\u043b\u043e\u0442 \u0438\u0437\u043e\u0431\u0440\u0451\u043b \u0443\u0440\u043e\u0434\u043b\u0438\u0432\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e <code>list(set(words))<\/code>, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u0435\u0440\u043d\u0443\u043b \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430.<\/p>\n<h3>\u0423\u0434\u0430\u043b\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442<\/h3>\n<pre><code class=\"python\"># remove second element from list def remove_second(lst: list) -> list:     lst.pop(1)     return lst<\/code><\/pre>\n<p>\u0410 \u0432\u043e\u0442 \u044d\u0442\u043e \u0433\u043e\u0432\u043d\u043e. \u041c\u0443\u0436\u0438\u043a \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u043c\u0443\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442, <em>\u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442<\/em> \u0435\u0433\u043e \u0438 \u0435\u0433\u043e \u0436\u0435 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442.<\/p>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 \u043f\u0438\u0442\u043e\u043d\u0435: <code>reversed()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043f\u0438\u044e \u0438 \u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b, \u0430 <code>.reverse()<\/code> \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b.<br \/>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432 pandas: <code>apply()<\/code> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043f\u0438\u044e \u0438 \u043d\u0435 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b, \u0430 \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u043c <code>inplace=True<\/code> \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b.<\/p>\n<p>\u0414\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043e\u0434\u043d\u043e.<\/p>\n<h2>\u0427\u0442\u043e \u044f \u043f\u043e\u043d\u044f\u043b<\/h2>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0443\u0442 \u043a\u043e \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0434\u0443\u0432\u043d\u043e\u0433\u043e \u043c\u0443\u0436\u0438\u043a\u0430 \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0422\u0417 \u0431\u044b\u043b\u043e \u0447\u0451\u0442\u043a\u0438\u043c, \u0430 \u043d\u0435 \u043a\u0430\u043a \u043c\u044b \u0441 \u0432\u0430\u043c\u0438 \u043f\u0440\u0438\u0432\u044b\u043a\u043b\u0438: &#171;\u043d\u0430\u043f\u0438\u0448\u0438 \u0447\u043e\u043d\u0438\u0442\u044c \u0448\u043e\u0431 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u043a\u0430\u043a \u043d\u0430\u0434\u043e&#187;. \u041f\u043e \u043e\u043f\u044b\u0442\u0443 \u0437\u043d\u0430\u044e, \u0447\u0442\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438 \u0422\u0417 \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043d\u0438\u043c\u0430\u0442\u044c <strong>\u043c\u043d\u043e\u0433\u043e<\/strong> \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0442\u0430\u043a \u0438\u043c\u0435\u0435\u0442 \u043b\u0438 \u0441\u043c\u044b\u0441\u043b \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0434\u043b\u0438\u043d\u043d\u0435\u0435 \u0441\u0430\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438? \u0412\u043e\u0442 \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u043c\u0443\u0436\u0438\u043a \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043b \u0433\u043e\u0434\u043d\u043e\u0442\u0443:<\/p>\n<pre><code class=\"python\"># function which receives password length and generates random password  # of specified length; uses \"secrets\" module def generate_random_password(length: int) -> str:     import secrets     return secrets.token_urlsafe(length) <\/code><\/pre>\n<h2>\u0414\u043b\u0438\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/h2>\n<p>\u0410 \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0447\u0442\u043e\u0431\u044b \u043c\u0443\u0436\u0438\u043a \u043f\u0438\u0441\u0430\u043b \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u044f? \u0410 \u0442\u043e \u043d\u0435\u0447\u0435\u0441\u0442\u043d\u043e.<\/p>\n<h3>\u041a\u043b\u0430\u0441\u0441 \u043c\u043d\u0435 \u0437\u0430\u043f\u0438\u043b\u0438<\/h3>\n<p>\u0421\u0434\u0435\u043b\u0430\u0439 \u043c\u043d\u0435 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430!<\/p>\n<pre><code class=\"python\"># person class class Person:     def __init__(self, name: str, age: int):         self.name = name         self.age = age      def __str__(self):         return f'{self.name}, {self.age}'  <\/code><\/pre>\n<p>\u0410\u043b\u0451! \u0422\u044b \u0438\u0437 \u043a\u0440\u0438\u043e\u043a\u0430\u043c\u0435\u0440\u044b \u0432\u044b\u043b\u0435\u0437? \u0413\u0434\u0435 \u0434\u0430\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u044b?<\/p>\n<pre><code class=\"python\"># person dataclass @dataclass class Person:     name: str     age: int <\/code><\/pre>\n<p>\u0422\u0430\u043a-\u0442\u043e! \u041c\u044b \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0437 \u0442\u0435\u0431\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430! \u0412\u043e\u043e\u0431\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0451 \u0441\u0434\u0435\u043b\u0430\u0442\u044c <code>@dataclass(slots=True, kw_only=True)<\/code>, \u043d\u043e copilot \u043c\u043d\u0435 \u043d\u0435 \u043f\u043b\u0430\u0442\u0438\u0442 \u0437\u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 (\u043d\u043e \u0432\u044b <a href=\"https:\/\/t.me\/ae071087\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0436\u0435\u0442\u0435<\/a>), \u0442\u0430\u043a \u0447\u0442\u043e \u0443\u0447\u0438\u0442\u044c \u044f \u0435\u0433\u043e \u043d\u0435 \u0431\u0443\u0434\u0443.<\/p>\n<h3>\u041f\u0440\u043e\u0441\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0439 \u0437\u0430\u043f\u0440\u043e\u0441<\/h3>\n<pre><code class=\"python\"># makes async requests to url async def make_request(url: str):     import requests     response = requests.get(url)     return response.text<\/code><\/pre>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0422\u0443\u0442 \u0431\u044b \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0442\u044c <a href=\"https:\/\/www.python-httpx.org\/\" rel=\"noopener noreferrer nofollow\">httpx<\/a>&#8230;<\/p>\n<h3>\u0427\u0438\u0442\u0430\u0439 \u0444\u0430\u0439\u043b \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u043c\u0438<\/h3>\n<pre><code class=\"python\"># read file exluding blank lines and lines starting with \"#\" def read_file_exluding_blank_lines_and_lines_starting_with_hash(file: str) -> list:     with open(file, 'r') as f:         return [line for line in f if line and not line.startswith('#')]<\/code><\/pre>\n<p>\u0410 \u044f-\u0442\u043e \u0434\u0443\u043c\u0430\u043b, \u0447\u0442\u043e \u044d\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439&#8230;<\/p>\n<p>\u041e\u043f\u044f\u0442\u044c \u0436\u0435, \u043f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440? \u0424\u0430\u0439\u043b\u044b \u0431\u044b\u0432\u0430\u044e\u0442 \u0431\u043e\u043b\u044c\u0448\u0438\u0435.<\/p>\n<h3>\u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0439 \u0444\u0430\u0439\u043b \u043f\u043e \u043a\u0443\u0441\u043e\u0447\u043a\u0430\u043c<\/h3>\n<pre><code class=\"python\"># read file by chunks of 5 lines def read_file_by_chunks(file: str) -> list:     with open(file, 'r') as f:         return [f.readlines(5)]<\/code><\/pre>\n<p>\u041d\u0435 \u0437\u043d\u0430\u044e, \u0433\u0434\u0435 \u0438 \u043a\u0442\u043e \u043d\u0430\u0434\u0443\u0432\u0430\u043b \u044d\u0442\u043e\u0433\u043e \u043c\u0443\u0436\u0438\u043a\u0430, \u043d\u043e \u043f\u0440\u043e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043e\u043d \u044f\u0432\u043d\u043e \u043d\u0435 \u0441\u043b\u044b\u0448\u0430\u043b. \u0410 \u0435\u0449\u0451 \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442 \u043f\u043e\u043b\u043d\u0443\u044e, \u0442\u043e\u0442\u0430\u043b\u044c\u043d\u0443\u044e \u0445\u0440\u0435\u043d\u044c \u0432 \u044d\u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435: \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a, \u0433\u0434\u0435 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &#8212; \u044d\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0435 5 \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u0444\u0430\u0439\u043b\u0430.<\/p>\n<h3>Dict \u0432 \u0444\u0430\u0439\u043b<\/h3>\n<pre><code class=\"python\"># write dictionary to file def write_dictionary_to_file(dictionary: dict, file: str):     with open(file, 'w') as f:         for key, value in dictionary.items():             f.write(f'{key} {value}\\n')<\/code><\/pre>\n<p>\u0427\u0435\u0441\u0442\u043d\u043e, \u044f \u0431 \u043d\u0435 \u0434\u043e\u0434\u0443\u043c\u0430\u043b\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u0447\u043a\u0438 <code>\u043a\u043b\u044e\u0447 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/code>! \u0410 \u0435\u0441\u043b\u0438 \u043a\u043b\u044e\u0447 \u0441 \u043f\u0440\u043e\u0431\u0435\u043b\u043e\u043c, \u0442\u043e \u043a\u0430\u043a \u043e\u0442\u043b\u0438\u0447\u0438\u0442\u044c \u043a\u043b\u044e\u0447 \u043e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f: <code>\u043a\u043b\u044e\u0447 \u0445\u0437\u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/code>?<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u043c\u0435\u043a\u043d\u0451\u043c \u043d\u0430 json:<\/p>\n<pre><code class=\"python\"># write dictionary to json file def write_dictionary_to_json_file(dictionary:<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-333349","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/333349","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=333349"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/333349\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=333349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=333349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=333349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}