{"id":292148,"date":"2019-07-16T15:02:03","date_gmt":"2019-07-16T15:02:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=292148"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=292148","title":{"rendered":"\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432 \u0432 Python"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th>\u0414\u043e<\/th>\n<th>\u041f\u043e\u0441\u043b\u0435<\/th>\n<\/tr>\n<tr>\n<td>\n<pre><code class=\"python\">import math import os.path  import requests  # 100500 other imports  print(math.pi) print(os.path.join('my', 'path')) print(requests.get)<\/code><\/pre>\n<\/td>\n<td>\n<pre><code class=\"python\">import smart_imports  smart_imports.all()  print(math.pi) print(os_path.join('my', 'path')) print(requests.get) <\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>\u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0430\u0436 \u0441 2012 \u0433\u043e\u0434\u0430 \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e open source \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043a\u0443, \u044f\u0432\u043b\u044f\u044f\u0441\u044c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c. \u041d\u0430 Python \u0441\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439. \u0411\u0440\u0430\u0443\u0437\u0435\u0440\u043a\u0430 \u2014 \u0448\u0442\u0443\u043a\u0430 \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 1000 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0438 \u0431\u043e\u043b\u0435\u0435 120 000 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043d\u0430 Python. \u0412 \u0441\u0443\u043c\u043c\u0435 \u0436\u0435 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438-\u0441\u043f\u0443\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0430 \u0432 \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u0431\u043e\u043b\u044c\u0448\u0435. <\/p>\n<p>  \u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u043d\u0435 \u043d\u0430\u0434\u043e\u0435\u043b\u043e \u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u0430\u0436\u0430\u043c\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0440\u0430\u0437 \u0438 \u043d\u0430\u0432\u0441\u0435\u0433\u0434\u0430. \u0422\u0430\u043a \u0440\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <b>smart_imports<\/b> (<a href=\"https:\/\/github.com\/Tiendil\/smart-imports\">github<\/a>, <a href=\"https:\/\/pypi.org\/project\/smart-imports\/\">pypi<\/a>).<\/p>\n<p>  \u0418\u0434\u0435\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430. \u041b\u044e\u0431\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043e\u0431 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0441\u0435\u0433\u043e. <b>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0432 \u0431\u043e\u043b\u0435\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u0442\u043e \u043b\u044e\u0431\u0443\u044e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441 \u043d\u0435\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. <\/b><\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c <code>import math<\/code> \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <code>math.pi<\/code> \u2014 \u043c\u044b \u0438 \u0442\u0430\u043a \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>math<\/code> \u2014 \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>  Smart imports \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 Python &gt;= 3.5 \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043a\u0440\u044b\u0442\u0430 \u0442\u0435\u0441\u0442\u0430\u043c\u0438, <a href=\"https:\/\/coveralls.io\/github\/Tiendil\/smart-imports?branch=develop\">coverage &gt; 95%<\/a>. \u0421\u0430\u043c \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u0443\u0436\u0435 \u0433\u043e\u0434.<\/p>\n<p>  \u0417\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u043e\u0434 \u043a\u0430\u0442.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u041a\u0430\u043a \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u0446\u0435\u043b\u043e\u043c<\/h2>\n<p>  \u0418\u0442\u0430\u043a, \u043a\u043e\u0434 \u0438\u0437 \u0437\u0430\u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <\/p>\n<ol>\n<li>\u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u0437\u043e\u0432\u0430 <code>smart_imports.all()<\/code> \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0441\u0442\u0440\u043e\u0438\u0442 <abbr title=\"Abstract syntax tree\">AST<\/abbr> \u043c\u043e\u0434\u0443\u043b\u044f, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u0434\u0435\u043b\u0430\u043d \u0432\u044b\u0437\u043e\u0432;<\/li>\n<li>\u041d\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435;<\/li>\n<li>\u0418\u043c\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u043d\u0430\u0439\u0442\u0438 \u043d\u0443\u0436\u043d\u044b\u0439 \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043c\u043e\u0434\u0443\u043b\u044c (\u0438\u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043c\u043e\u0434\u0443\u043b\u044f). \u0415\u0441\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442\u0441\u044f.<\/li>\n<li>\u041d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u044e\u0442\u0441\u044f, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u0432 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e \u0438\u043c\u0451\u043d (\u043b\u0438\u0431\u043e \u0442\u0443\u0434\u0430 \u043f\u043e\u043c\u0435\u0449\u0430\u044e\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u044d\u0442\u0438\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439). <\/li>\n<\/ol>\n<p>  \u041d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u0449\u0443\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u0435\u0445 \u043c\u0435\u0441\u0442\u0430\u0445 \u043a\u043e\u0434\u0430, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u043d\u043e\u0432\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441.<\/p>\n<p>  \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u0435\u0445 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 <code>smart_imoprts.all()<\/code>. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 smart imports \u043d\u0435 \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u044b. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0432\u043d\u0435\u0434\u0440\u044f\u0442\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e, \u0440\u0430\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0446\u0438\u043a\u043b\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438.<\/p>\n<p>  \u0414\u043e\u0442\u043e\u0448\u043b\u0438\u0432\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043c\u0435\u0442\u0438\u0442, \u0447\u0442\u043e AST \u043c\u043e\u0434\u0443\u043b\u044f \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0434\u0432\u0430 \u0440\u0430\u0437\u0430: <\/p>\n<ul>\n<li>\u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437 \u0435\u0433\u043e \u0441\u0442\u0440\u043e\u0438\u0442 CPython \u0432\u043e \u0432 \u0432\u0440\u0435\u043c\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043c\u043e\u0434\u0443\u043b\u044f;<\/li>\n<li>\u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437 \u0435\u0433\u043e \u0441\u0442\u0440\u043e\u0438\u0442 smart_imports \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u0437\u043e\u0432\u0430 <code>smart_imports.all()<\/code>.<\/li>\n<\/ul>\n<p>  AST \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u0438\u043d \u0440\u0430\u0437 (\u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0432\u0441\u0442\u0440\u043e\u0438\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e import hooks \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0432 <a href=\"https:\/\/www.python.org\/dev\/peps\/pep-0302\/\">PEP-0302<\/a>, \u043d\u043e \u0442\u0430\u043a\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043c\u0435\u0434\u043b\u044f\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u043f\u043e\u0447\u0435\u043c\u0443?<\/b><\/p>\n<div class=\"spoiler_text\">\u0421\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0434\u0432\u0443\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 (\u0441 \u0445\u0443\u043a\u0430\u043c\u0438 \u0438 \u0431\u0435\u0437), \u044f \u043f\u0440\u0438\u0448\u0451\u043b \u043a \u0432\u044b\u0432\u043e\u0434\u0443, \u0447\u0442\u043e \u043f\u0440\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0435 \u043c\u043e\u0434\u0443\u043b\u044f CPython \u0441\u0442\u0440\u043e\u0438\u0442 AST \u0432 \u0441\u0432\u043e\u0438\u0445 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0445 (C-\u0448\u043d\u044b\u0445) \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0438\u0445 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0434\u0430\u043d\u043d\u044b\u0445 Python \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0434\u043e\u0440\u043e\u0436\u0435, \u0447\u0435\u043c \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0434\u0435\u0440\u0435\u0432\u0430 \u043f\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f <a href=\"https:\/\/docs.python.org\/3\/library\/ast.html\">ast<\/a>.  <\/div>\n<\/div>\n<p>  \u0421\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, AST \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0438 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0437\u0430 \u0437\u0430\u043f\u0443\u0441\u043a.<\/p>\n<h2>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e<\/h2>\n<p>  \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043e\u043d\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u0438 \u043f\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c:<\/p>\n<ol>\n<li>\u041f\u043e \u0442\u043e\u0447\u043d\u043e\u043c\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0438\u043c\u0435\u043d\u0438 \u0438\u0449\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u0440\u044f\u0434\u043e\u043c \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c (\u0432 \u0442\u043e\u043c \u0436\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435).<\/li>\n<li>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<br \/> \n<ul>\n<li>\u043f\u043e \u0442\u043e\u0447\u043d\u043e\u043c\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0438\u043c\u0435\u043d\u0438 \u0434\u043b\u044f \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f;<\/li>\n<li>\u0434\u043b\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u0430\u0432\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u0441 \u0437\u0430\u043c\u0435\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u043d\u0430 \u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>os.path<\/code> \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <code>os_path<\/code>.<\/li>\n<\/ul>\n<\/li>\n<li>\u041f\u043e \u0442\u043e\u0447\u043d\u043e\u043c\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e \u0438\u043c\u0435\u043d\u0438 \u0438\u0449\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0449\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 <a href=\"https:\/\/pypi.org\/project\/requests\/\">requests<\/a>.<\/li>\n<\/ol>\n<p>  <\/p>\n<h2>\u041f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h2>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430 smart imports \u043d\u0435 \u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f\u0445 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u0435\u0451 \u0437\u0430\u043f\u0443\u0441\u043a\u0430.<\/p>\n<p>  \u0418\u0437-\u0437\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f AST \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0432 1.5-2 \u0440\u0430\u0437\u0430. \u0414\u043b\u044f \u043c\u0430\u043b\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u044d\u0442\u043e \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u0412 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445 \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0442\u0440\u0430\u0434\u0430\u0435\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u043e\u0442 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439 \u043c\u0435\u0436\u0434\u0443 \u043c\u043e\u0434\u0443\u043b\u044f\u043c\u0438, \u0447\u0435\u043c \u043e\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. <\/p>\n<p>  <s>\u041a\u043e\u0433\u0434\u0430<\/s> \u0435\u0441\u043b\u0438 smart imports \u0441\u0442\u0430\u043d\u0443\u0442 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u043c\u0438, \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0443 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 AST \u043d\u0430 C \u2014 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u043d\u043e \u0441\u043d\u0438\u0437\u0438\u0442\u044c \u0438\u0437\u0434\u0435\u0440\u0436\u043a\u0438 \u043f\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 AST \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435. \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435. \u0421\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439, \u043a\u044d\u0448 \u0438\u043d\u0432\u0430\u043b\u0438\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432.<\/p>\n<p>  \u041d\u0430 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u043b\u0438\u044f\u0435\u0442 \u043a\u0430\u043a \u043f\u0435\u0440\u0435\u0447\u0435\u043d\u044c \u043f\u0440\u0430\u0432\u0438\u043b \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0442\u0430\u043a \u0438 \u0438\u0445 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u0422\u0430\u043a \u043a\u0430\u043a \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c Python \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u0435\u0439. \u0418\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u0438 \u0440\u0430\u0441\u0445\u043e\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u043c\u0451\u043d \u0438 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u00ab\u041a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430\u00bb (\u0441\u043c. \u0434\u0430\u043b\u0435\u0435).<\/p>\n<h2>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f<\/h2>\n<p>  \u0414\u0435\u0444\u043e\u043b\u0442\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0440\u0430\u043d\u0435\u0435. \u0415\u0451 \u0434\u043e\u043b\u0436\u043d\u043e \u0445\u0432\u0430\u0442\u0430\u0442\u044c \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0414\u0435\u0444\u043e\u043b\u0442\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"json\">{     \"cache_dir\": null,     \"rules\": [{\"type\": \"rule_local_modules\"},               {\"type\": \"rule_stdlib\"},               {\"type\": \"rule_predefined_names\"},               {\"type\": \"rule_global_modules\"}] }<\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443.<\/p>\n<p>  <a href=\"https:\/\/gist.github.com\/Tiendil\/837423689595e548b0b22f20c2c2149f\">\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0430<\/a> (\u0438\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043a\u0438).<\/p>\n<p>  \u0412\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u0437\u043e\u0432\u0430 <code>smart_import.all()<\/code> \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c \u0444\u0430\u0439\u043b <code>smart_imports.json<\/code> \u043f\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u043e\u0442 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430 \u043a \u043a\u043e\u0440\u043d\u0435\u0432\u043e\u043c\u0443. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b \u043d\u0430\u0439\u0434\u0435\u043d, \u043e\u043d \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439 \u0434\u043b\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f. <\/p>\n<p>  \u041c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 (\u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0432 \u0438\u0445 \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0430\u0445).<\/p>\n<p>  \u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0435 \u0442\u0430\u043a \u043c\u043d\u043e\u0433\u043e:<\/p>\n<pre><code class=\"json\">{     \/\/ \u041a\u0430\u0442\u0430\u043b\u043e\u0433 \u0434\u043b\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043a\u044d\u0448\u0430 AST.     \/\/ \u0415\u0441\u043b\u0438 \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d \u0438\u043b\u0438 null \u2014 \u043a\u044d\u0448 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f.     \"cache_dir\": null|\"string\",      \/\/ \u0421\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u043f\u0440\u0430\u0432\u0438\u043b \u0432 \u043f\u043e\u0440\u044f\u0434\u043a\u0435 \u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f.     \"rules\": [] }<\/code><\/pre>\n<p>  <\/p>\n<h2>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0430<\/h2>\n<p>  \u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0443\u043a\u0430\u0437\u0430\u043d\u0438\u044f \u043f\u0440\u0430\u0432\u0438\u043b \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f. \u041f\u0435\u0440\u0432\u043e\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0432\u0448\u0435\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0439 \u043f\u043e\u0438\u0441\u043a \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432.<\/p>\n<p>  \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u043a\u043e\u043d\u0444\u0438\u0433\u043e\u0432 \u0434\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0435\u0442 \u0447\u0430\u0441\u0442\u043e \u0444\u0438\u0433\u0443\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u043e <code>rule_predefined_names<\/code>, \u043e\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043b\u0438\u0441\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>print<\/code>).<\/p>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 1: \u041f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430<\/h3>\n<p>  \u041f\u0440\u0430\u0432\u0438\u043b\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0435\u0434\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u0432\u0440\u043e\u0434\u0435 <code>__file__<\/code> \u0438 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <code>print<\/code>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043a\u043e\u043d\u0444\u0438\u0433: # { #    \"rules\": [{\"type\": \"rule_predefined_names\"}] # }  import smart_imports  smart_imports.all()  # \u043c\u044b \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043a\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0441 \u0438\u043c\u0435\u043d\u0435\u043c __file__ # \u0445\u043e\u0442\u044f \u0432 \u043a\u043e\u0434\u0435 \u044d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u043d\u0435 \u043f\u0440\u043e\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0430 print(__file__)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 2: \u041b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/h3>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u0435\u0441\u0442\u044c \u043b\u0438 \u0440\u044f\u0434\u043e\u043c \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c \u043c\u043e\u0434\u0443\u043b\u0435\u043c (\u0432 \u0442\u043e\u043c \u0436\u0435 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435) \u043c\u043e\u0434\u0443\u043b\u044c \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u043c \u0438\u043c\u0435\u043d\u0435\u043c. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0435\u0433\u043e.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043a\u043e\u043d\u0444\u0438\u0433: # { #    \"rules\": [{\"type\": \"rule_predefined_names\"}, #              {\"type\": \"rule_local_modules\"}] # } # # \u043a\u043e\u0434 \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435: # # my_package # |-- __init__.py # |-- a.py # |-- b.py  # b.py import smart_imports  smart_imports.all()  # \u0411\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043c\u043e\u0434\u0443\u043b\u044c \"a.py\" print(a)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 3: \u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/h3>\n<p>  \u041f\u0440\u043e\u0431\u0443\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e \u0438\u043c\u0435\u043d\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0434\u0443\u043b\u044c <a href=\"https:\/\/pypi.org\/project\/requests\/\">requests<\/a>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043a\u043e\u043d\u0444\u0438\u0433: # { #    \"rules\": [{\"type\": \"rule_predefined_names\"}, #              {\"type\": \"rule_global_modules\"}] # } # # \u0441\u0442\u0430\u0432\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 # # pip install requests  import smart_imports  smart_imports.all()  # \u0411\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043c\u043e\u0434\u0443\u043b\u044c requests print(requests.get('http:\/\/example.com'))<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 4: \u041a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430<\/h3>\n<p>  \u0421\u043e\u043e\u0442\u043d\u043e\u0441\u0438\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c \u0438\u043b\u0438 \u0435\u0433\u043e \u0430\u0442\u0440\u0438\u0431\u0443\u0442. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043a\u043e\u043d\u0444\u0438\u0433: # { #    \"rules\": [{\"type\": \"rule_predefined_names\"}, #              {\"type\": \"rule_custom\", #               \"variables\": {\"my_import_module\": {\"module\": \"os.path\"}, #                             \"my_import_attribute\": {\"module\": \"random\", \"attribute\": \"seed\"}}}] # }  import smart_imports  smart_imports.all()  # \u0412 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0438\u0441\u043f\u043b\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u043c\u043e\u0434\u0443\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 # \u041d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u043e\u0434\u0443\u043b\u044c print(my_import_module) print(my_import_attribute)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 5: \u0421\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438<\/h3>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442, \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0438\u043c\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u043c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <a href=\"https:\/\/docs.python.org\/3\/library\/math.html\">math<\/a> \u0438\u043b\u0438 <a href=\"https:\/\/docs.python.org\/3\/library\/os.path.html\">os.path<\/a> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 <code>os_path<\/code>.<\/p>\n<p>  \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0447\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u043e\u0434\u0443\u043b\u0435\u0439, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u043f\u043e \u0437\u0430\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u0441\u043f\u0438\u0441\u043a\u0443. \u0421\u043f\u0438\u0441\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 Python \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u043e\u0442\u0441\u044e\u0434\u0430: <a href=\"https:\/\/github.com\/jackmaney\/python-stdlib-list\">github.com\/jackmaney\/python-stdlib-list<\/a><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043a\u043e\u043d\u0444\u0438\u0433: # { #    \"rules\": [{\"type\": \"rule_predefined_names\"}, #              {\"type\": \"rule_stdlib\"}] # }  import smart_imports  smart_imports.all()  print(math.pi)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 6: \u0418\u043c\u043f\u043e\u0440\u0442 \u043f\u043e \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u0443<\/h3>\n<p>  \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u043e \u0438\u043c\u0435\u043d\u0438, \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430, \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441 \u0435\u0433\u043e \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c. \u0423\u0434\u043e\u0431\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445\u0441\u044f \u0432\u043e \u0432\u0441\u0451\u043c \u043a\u043e\u0434\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043a \u043c\u043e\u0434\u0443\u043b\u044f\u043c \u043f\u0430\u043a\u0435\u0442\u0430 <code>utils<\/code> \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u0435\u0444\u0438\u043a\u0441\u043e\u043c <code>utils_<\/code>.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043a\u043e\u043d\u0444\u0438\u0433: # { #    \"rules\": [{\"type\": \"rule_predefined_names\"}, #              {\"type\": \"rule_prefix\", #               \"prefixes\": [{\"prefix\": \"utils_\", \"module\": \"my_package.utils\"}]}] # } # # \u043a\u043e\u0434 \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435: # # my_package # |-- __init__.py # |-- utils # |-- |-- __init__ # |-- |-- a.py # |-- |-- b.py # |-- subpackage # |-- |-- __init__ # |-- |-- c.py  # c.py  import smart_imports  smart_imports.all()  print(utils_a) print(utils_b)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 7: \u041c\u043e\u0434\u0443\u043b\u044c \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430<\/h3>\n<p>  \u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u043e\u0438\u043c\u0451\u043d\u043d\u044b\u0435 \u0441\u0443\u0431\u043f\u0430\u043a\u0435\u0442\u044b \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u044f\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <code>tests<\/code> \u0438\u043b\u0438 <code>migrations<\/code>), \u0434\u043b\u044f \u043d\u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0438\u0441\u043a\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u0438 \u0434\u043b\u044f \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u0432 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u0430\u0445.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043a\u043e\u043d\u0444\u0438\u0433: # { #    \"rules\": [{\"type\": \"rule_predefined_names\"}, #              {\"type\": \"rule_local_modules_from_parent\", #               \"suffixes\": [\".tests\"]}] # } # # \u043a\u043e\u0434 \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435: # # my_package # |-- __init__.py # |-- a.py # |-- tests # |-- |-- __init__ # |-- |-- b.py  # b.py  import smart_imports  smart_imports.all()  print(a)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u041f\u0440\u0430\u0432\u0438\u043b\u043e 8: \u041f\u0440\u0438\u0432\u044f\u0437\u043a\u0430 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u043f\u0430\u043a\u0435\u0442\u0443<\/h3>\n<p>  \u0414\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0438\u0437 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430 \u0440\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u0442 \u043f\u043e\u0438\u0441\u043a \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u0430\u0445 (\u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0435). \u0412 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u044f\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u0430 (\u041c\u043e\u0434\u0443\u043b\u044c \u0438\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u043f\u0430\u043a\u0435\u0442\u0430) \u043d\u0430 \u0432\u0435\u0441\u044c \u043f\u0440\u043e\u0435\u043a\u0442.<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u043a\u043e\u043d\u0444\u0438\u0433: # { #    \"rules\": [{\"type\": \"rule_predefined_names\"}, #              {\"type\": \"rule_local_modules_from_namespace\", #               \"map\": {\"my_package.subpackage_1\": [\"my_package.subpackage_2\"]}}] # } # # \u043a\u043e\u0434 \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435: # # my_package # |-- __init__.py # |-- subpackage_1 # |-- |-- __init__ # |-- |-- a.py # |-- subpackage_2 # |-- |-- __init__ # |-- |-- b.py  # a.py  import smart_imports  smart_imports.all()  print(b)<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<h3>\u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0430\u0432\u0438\u043b<\/h3>\n<p>  \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e:<\/p>\n<ol>\n<li>\u041d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u0441\u044f \u043e\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <a href=\"https:\/\/github.com\/Tiendil\/smart-imports\/blob\/develop\/smart_imports\/rules.py#L100\">smart_imports.rules.BaseRule<\/a>.<\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443.<\/li>\n<li>\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <a href=\"https:\/\/github.com\/Tiendil\/smart-imports\/blob\/develop\/smart_imports\/rules.py#L336\">smart_imports.rules.register<\/a><\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432 \u043a\u043e\u043d\u0444\u0438\u0433.<\/li>\n<li>???<\/li>\n<li>\u041f\u0440\u043e\u0444\u0438\u0442.<\/li>\n<\/ol>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/github.com\/Tiendil\/smart-imports\/blob\/develop\/smart_imports\/rules.py\">\u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u0440\u0430\u0432\u0438\u043b<\/a> <\/p>\n<h2>\u041f\u0440\u043e\u0444\u0438\u0442<\/h2>\n<p>  \u041f\u0440\u043e\u043f\u0430\u043b\u0438 \u043c\u043d\u043e\u0433\u043e\u0441\u0442\u0440\u043e\u0447\u043d\u044b\u0435 \u0441\u043f\u0438\u0441\u043a\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430.<\/p>\n<p>  C\u043e\u043a\u0440\u0430\u0442\u0438\u043b\u043e\u0441\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0442\u0440\u043e\u043a. \u0414\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043a\u0438 \u043d\u0430 smart imports \u0432 \u043d\u0435\u0439 \u0431\u044b\u043b\u043e 6688 \u0441\u0442\u0440\u043e\u043a \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0445 \u0437\u0430 \u0438\u043c\u043f\u043e\u0440\u0442. \u041f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c 2084 (\u043f\u043e \u0434\u0432\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 smart_imports \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0430\u0439\u043b + 130 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432, \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0445 \u044f\u0432\u043d\u043e \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043c\u0435\u0441\u0442).<\/p>\n<p>  \u041f\u0440\u0438\u044f\u0442\u043d\u044b\u043c \u0431\u043e\u043d\u0443\u0441\u043e\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u043c\u0451\u043d \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435. \u041a\u043e\u0434 \u0441\u0442\u0430\u043b\u043e \u043b\u0435\u0433\u0447\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043b\u0435\u0433\u0447\u0435 \u043f\u0438\u0441\u0430\u0442\u044c. \u041f\u0440\u043e\u043f\u0430\u043b\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0430\u0434 \u0438\u043c\u0435\u043d\u0430\u043c\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c\u044b\u0445 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0435\u0439 \u2014 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0447\u0451\u0442\u043a\u0438\u0445 \u043f\u0440\u0430\u0432\u0438\u043b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c.<\/p>\n<h2>\u041f\u043b\u0430\u043d\u044b \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f<\/h2>\n<p>  \u0418\u0434\u0435\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u043a\u043e\u0434\u0430 \u043f\u043e \u0438\u043c\u0435\u043d\u0430\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u043d\u0435 \u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u0443\u0434\u0443 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u0435\u0451 \u043a\u0430\u043a \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 smart imports, \u0442\u0430\u043a \u0438 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432.<\/p>\n<p>  \u041a\u0430\u0441\u0430\u0442\u0435\u043b\u044c\u043d\u043e smart imports, \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e:<\/p>\n<ol>\n<li>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u043d\u043e\u0432\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u0439 Python.<\/li>\n<li>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u0435\u0440\u0435\u0442\u044c\u0441\u044f \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0435 \u043d\u0430\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u0430 \u043f\u043e \u0430\u043d\u043d\u043e\u0442\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u0442\u0438\u043f\u0430\u043c\u0438. <\/li>\n<li>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043b\u0435\u043d\u0438\u0432\u044b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u044b.<\/li>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043a\u043e\u043d\u0444\u0438\u0433\u0430 \u043f\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c \u0438 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433\u0443 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 smart_imports.<\/li>\n<li>\u041f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u043d\u0430 C, \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 AST.<\/li>\n<li>\u0420\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u0441 \u043b\u0438\u043d\u0442\u0435\u0440\u0430\u043c\u0438 \u0438 IDE, \u0435\u0441\u043b\u0438 \u0443 \u0442\u0435\u0445 \u0431\u0443\u0434\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0430\u043d\u0430\u043b\u0438\u0437\u043e\u043c \u043a\u043e\u0434\u0430 \u0431\u0435\u0437 \u044f\u0432\u043d\u044b\u0445 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432.<\/li>\n<\/ol>\n<p>  \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043c\u043d\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0432\u0430\u0448\u0435 \u043c\u043d\u0435\u043d\u0438\u0435 \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0434\u0435\u0444\u043e\u043b\u0442\u043d\u043e\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0438 \u043f\u0440\u0430\u0432\u0438\u043b \u0438\u043c\u043f\u043e\u0440\u0442\u0430.<\/p>\n<p>  \u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0447\u0442\u043e \u043e\u0441\u0438\u043b\u0438\u043b\u0438 \u044d\u0442\u0443 \u043f\u0440\u043e\u0441\u0442\u044b\u043d\u044e \u0442\u0435\u043a\u0441\u0442\u0430 \ud83d\ude00<\/p><\/div>\n<p>               <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \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\/459930\/\"> https:\/\/habr.com\/ru\/post\/459930\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\n<div class=\"scrollable-table\">\n<table>\n<tr>\n<th>\u0414\u043e<\/th>\n<th>\u041f\u043e\u0441\u043b\u0435<\/th>\n<\/tr>\n<tr>\n<td>\n<pre><code class=\"python\">import math import os.path  import requests  # 100500 other imports  print(math.pi) print(os.path.join('my', 'path')) print(requests.get)<\/code><\/pre>\n<\/td>\n<td>\n<pre><code class=\"python\">import smart_imports  smart_imports.all()  print(math.pi) print(os_path.join('my', 'path')) print(requests.get) <\/code><\/pre>\n<\/td>\n<\/tr>\n<\/table>\n<\/div>\n<p>\u0422\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0430\u0436 \u0441 2012 \u0433\u043e\u0434\u0430 \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e open source \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u043a\u0443, \u044f\u0432\u043b\u044f\u044f\u0441\u044c \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u043c. \u041d\u0430 Python \u0441\u0430\u043c\u043e \u0441\u043e\u0431\u043e\u0439. \u0411\u0440\u0430\u0443\u0437\u0435\u0440\u043a\u0430 \u2014 \u0448\u0442\u0443\u043a\u0430 \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u043f\u0440\u043e\u0441\u0442\u0430\u044f, \u0441\u0435\u0439\u0447\u0430\u0441 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 1000 \u043c\u043e\u0434\u0443\u043b\u0435\u0439 \u0438 \u0431\u043e\u043b\u0435\u0435 120 000 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043d\u0430 Python. \u0412 \u0441\u0443\u043c\u043c\u0435 \u0436\u0435 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438-\u0441\u043f\u0443\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0430 \u0432 \u043f\u043e\u043b\u0442\u043e\u0440\u0430 \u0431\u043e\u043b\u044c\u0448\u0435. <\/p>\n<p>  \u0412 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u043d\u0435 \u043d\u0430\u0434\u043e\u0435\u043b\u043e \u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u0430\u0436\u0430\u043c\u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u043e\u0432 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0440\u0430\u0437 \u0438 \u043d\u0430\u0432\u0441\u0435\u0433\u0434\u0430. \u0422\u0430\u043a \u0440\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 <b>smart_imports<\/b> (<a href=\"https:\/\/github.com\/Tiendil\/smart-imports\">github<\/a>, <a href=\"https:\/\/pypi.org\/project\/smart-imports\/\">pypi<\/a>).<\/p>\n<p>  \u0418\u0434\u0435\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u0430. \u041b\u044e\u0431\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043e\u0431 \u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u0432\u0441\u0435\u0433\u043e. <b>\u0415\u0441\u043b\u0438 \u044d\u0442\u043e \u0441\u043e\u0433\u043b\u0430\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0432 \u0431\u043e\u043b\u0435\u0435 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u0442\u043e \u043b\u044e\u0431\u0443\u044e \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e \u0438\u043c\u0435\u043d\u0438 \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0441 \u043d\u0435\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. <\/b><\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0435 \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c <code>import math<\/code> \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a <code>math.pi<\/code> \u2014 \u043c\u044b \u0438 \u0442\u0430\u043a \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 <code>math<\/code> \u2014 \u043c\u043e\u0434\u0443\u043b\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438.<\/p>\n<p>  Smart imports \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 Python &gt;= 3.5 \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u043a\u0440\u044b\u0442\u0430 \u0442\u0435\u0441\u0442\u0430\u043c\u0438, <a href=\"https:\/\/coveralls.io\/github\/Tiendil\/smart-imports?branch=develop\">coverage &gt; 95%<\/a>. \u0421\u0430\u043c \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0441\u044c \u0443\u0436\u0435 \u0433\u043e\u0434.<\/p>\n<p>  \u0417\u0430 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u043f\u043e\u0434 \u043a\u0430\u0442.  <\/p>\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-292148","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292148","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=292148"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/292148\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=292148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=292148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=292148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}