{"id":307645,"date":"2020-07-29T09:00:17","date_gmt":"2020-07-29T09:00:17","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307645"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307645","title":{"rendered":"\u041a\u0430\u043a\u0430\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0431\u044b \u0431\u044b\u0442\u044c \u0432 Python"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/oleg-bunin\/blog\/512650\/\">\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>async<\/code> \u0438 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043d\u0438\u043a\u043b\u0430 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Statements\/async_function\">JavaScript<\/a>, <a href=\"https:\/\/doc.rust-lang.org\/std\/keyword.async.html\">Rust<\/a>, <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/language-reference\/operators\/await\">C#<\/a>, \u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Async\/await\">\u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435<\/a>. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432 Python \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c <code>async\/await<\/code>, \u043e\u043d\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0432 Python 3.5.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043f\u043e\u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043e\u0431 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430\u0445 \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435, \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0426\u0432\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/h2>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0432 \u044f\u0437\u044b\u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u043a\u043b\u044e\u0447\u0430\u044e\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043e\u043d \u043f\u043e \u0441\u0443\u0442\u0438 \u0440\u0430\u0441\u043a\u0430\u043b\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0434\u0432\u043e\u0435. \u041f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f <strong>\u043a\u0440\u0430\u0441\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/strong> (\u0438\u043b\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435), \u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f <strong>\u0441\u0438\u043d\u0438\u043c\u0438<\/strong> (\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438).<\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0438\u043d\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0440\u0430\u0441\u043d\u044b\u0435, \u043d\u043e \u043a\u0440\u0430\u0441\u043d\u044b\u0435 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u0441\u0438\u043d\u0438\u0435. \u0412 Python, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u0442\u0430\u043a: \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043d\u0435\u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u041d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e, \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043b\u0438 \u043d\u0435\u0442, \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e. Python \u0436\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432\u044b\u0439 \u044f\u0437\u044b\u043a.<\/p>\n<p>  \u042d\u0442\u043e\u0442 \u0440\u0430\u0441\u043a\u043e\u043b \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u044f\u0437\u044b\u043a\u0430 \u043d\u0430 \u0434\u0432\u0430 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430: \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435. Python 3.5 \u0432\u044b\u0448\u0435\u043b \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u044f\u0442\u0438 \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434, \u043d\u043e <code>async<\/code> \u0432\u0441\u0435 \u0435\u0449\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0442\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u043e, \u043a\u0430\u043a \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 Python.<\/p>\n<p>  \u0411\u043e\u043b\u044c\u0448\u0435 \u043e \u0446\u0432\u0435\u0442\u0430\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u0439 <a href=\"http:\/\/journal.stuffwithstuff.com\/2015\/02\/01\/what-color-is-your-function\/\">\u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<h2>\u0414\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430<\/h2>\n<p>  \u0420\u0430\u0437\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u041f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u044c\u0442\u0435, \u0432\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0435 CLI-\u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432\u0435\u0431-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439, \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u0435\u0433\u043e \u0440\u0430\u0431\u043e\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b \u043f\u0438\u0448\u0435\u0442\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0438 \u043d\u0435 \u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0430\u0448 \u043a\u043e\u0434. \u0418 \u0440\u0435\u0447\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445 PyPI, \u043d\u043e \u0438 \u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u0445 \u0441 \u043e\u0431\u0449\u0435\u0439 \u043b\u043e\u0433\u0438\u043a\u043e\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 Django \u0438 aiohttp. \u0425\u043e\u0442\u044f, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043f\u0438\u0448\u0443\u0442\u0441\u044f \u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u0438\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.<\/p>\n<p>  \u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"python\">def fetch_resource_size(url: str) -&gt; int:     response = client_get(url)     return len(response.content)<\/code><\/pre>\n<p>  \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0445\u043e\u0440\u043e\u0448\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u043e\u0433:<\/p>\n<pre><code class=\"python\">async def fetch_resource_size(url: str) -&gt; int:     response = await client_get(url)     return len(response.content)<\/code><\/pre>\n<p>  \u0412 \u0446\u0435\u043b\u043e\u043c, \u044d\u0442\u043e \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u043a\u043e\u0434, \u043d\u043e \u0441 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u0441\u043b\u043e\u0432 <code>async<\/code> \u0438 <code>await<\/code>. \u0418 \u044f \u044d\u0442\u043e \u043d\u0435 \u0432\u044b\u0434\u0443\u043c\u0430\u043b \u2014 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0432 \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u043f\u043e httpx:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.python-httpx.org\/quickstart\/\">\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>;<\/li>\n<li><a href=\"https:\/\/www.python-httpx.org\/async\/\">\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434<\/a>.<\/li>\n<\/ul>\n<p>  \u0422\u0430\u043c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u0430.<\/p>\n<h2>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f \u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f<\/h2>\n<p>  \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0440\u0430\u0441\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0442\u0443\u0442 \u0438 \u0442\u0430\u043c <code>async<\/code> \u0438 <code>await<\/code>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0441\u0442\u0430\u043b\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439.<\/p>\n<p>  \u0412 \u0440\u0435\u0448\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043c\u043e\u0447\u044c \u0434\u0432\u0430 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u043a\u0430\u0440\u0442\u0438\u043d\u0443 \u0431\u043e\u043b\u0435\u0435 \u044f\u0441\u043d\u043e.<\/p>\n<pre><code class=\"python\">def fetch_resource_size(url: str) -&gt; Abstraction[int]:     return client_get(url).map(         lambda response: len(response.content),     )<\/code><\/pre>\n<p>  \u0412\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u043c\u0435\u0442\u043e\u0434 <code>.map<\/code>, \u0447\u0442\u043e \u043e\u043d \u0434\u0435\u043b\u0430\u0435\u0442. \u0422\u0430\u043a \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0439 \u0438 \u0447\u0438\u0441\u0442\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u0443\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e \u0441 \u043d\u043e\u0432\u044b\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0438\u0437 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0439. \u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u043c, <code>client_get(url)<\/code> \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>Abstraction[Response]<\/code>, \u0430 \u0432\u044b\u0437\u043e\u0432 <code>.map(lambda response: len(response.content))<\/code> \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043e\u0442\u0432\u0435\u0442 \u0432 \u0442\u0440\u0435\u0431\u0443\u0435\u043c\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 <code>Abstraction[int]<\/code>.<\/p>\n<p>  \u0421\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0430\u043b\u044c\u0448\u0435. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u043a\u0430\u043a \u043b\u0435\u0433\u043a\u043e \u043c\u044b \u043f\u0435\u0440\u0435\u0448\u043b\u0438 \u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b\u0445 \u0448\u0430\u0433\u043e\u0432 \u043a \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u044b\u0437\u043e\u0432\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u043c\u044b \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0438 \u0442\u0438\u043f \u043e\u0442\u0432\u0435\u0442\u0430: \u0442\u0435\u043f\u0435\u0440\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u043a\u043e\u0434 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0435\u0439:<\/p>\n<pre><code class=\"python\">def fetch_resource_size(url: str) -&gt; AsyncAbstraction[int]:     return client_get(url).map(         lambda response: len(response.content),     )<\/code><\/pre>\n<p>  \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f, \u2014 \u044d\u0442\u043e \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u2014 <code>AsyncAbstraction<\/code>. \u0412 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u0434 \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u0438\u043c \u0436\u0435. \u0411\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 <code>async<\/code> \u0438 <code>await<\/code>. <code>await<\/code> \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043e\u043e\u0431\u0449\u0435 (<em>\u0440\u0430\u0434\u0438 \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0451 \u0438 \u0437\u0430\u0442\u0435\u0432\u0430\u043b\u043e\u0441\u044c<\/em>), \u0430 \u0431\u0435\u0437 \u043d\u0435\u0433\u043e \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u0438 \u0432 <code>async<\/code>.<\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0435, \u0447\u0442\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u044d\u0442\u043e \u0440\u0435\u0448\u0438\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u043a\u043b\u0438\u0435\u043d\u0442 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d: \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0438\u043b\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439.<\/p>\n<pre><code class=\"python\">def fetch_resource_size(     client_get: Callable[[str], AbstactionType[Response]],     url: str, ) -&gt; AbstactionType[int]:     return client_get(url).map(         lambda response: len(response.content),     )<\/code><\/pre>\n<p>  <code>client_get<\/code> \u0442\u0435\u043f\u0435\u0440\u044c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e \u0442\u0438\u043f\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0441\u0442\u0440\u043e\u043a\u0443 URL-\u0430\u0434\u0440\u0435\u0441\u0430 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0442\u0438\u043f <code>AbstractionType<\/code> \u043d\u0430\u0434 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c <code>Response<\/code>. <code>AbstractionType<\/code> \u2014 \u043b\u0438\u0431\u043e <code>Abstraction<\/code>, \u043b\u0438\u0431\u043e <code>AsyncAbstraction<\/code> \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432.<\/p>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c <code>Abstraction<\/code>, \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 <code>AsyncAbstraction<\/code> \u2014 \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u043a\u043e\u0434 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.<\/p>\n<h2>IOResult \u0438 FutureResult<\/h2>\n<p>  \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0432 <a href=\"https:\/\/github.com\/dry-python\/returns\"><code>dry-python\/returns<\/code><\/a> \u0443\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438.<\/p>\n<p>  \u041f\u043e\u0437\u0432\u043e\u043b\u044c\u0442\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432\u0430\u043c \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439, \u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u044b\u0439 \u043a mypy, \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u044f\u0449\u0438\u0439 \u043e\u0442 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 Python \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u0412 \u043d\u0451\u043c \u0435\u0441\u0442\u044c \u043f\u043e\u0442\u0440\u044f\u0441\u0430\u044e\u0449\u0438\u0435, \u0443\u0434\u043e\u0431\u043d\u044b\u0435, \u0437\u0430\u043c\u0435\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435.<\/p>\n<h3>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442<\/h3>\n<p>  \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<pre><code class=\"python\">pip install returns httpx anyio<\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043c \u043f\u0441\u0435\u0432\u0434\u043e\u043a\u043e\u0434 \u0432 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043e\u0434 \u043d\u0430 Python. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430.<\/p>\n<pre><code class=\"python\">from typing import Callable   import httpx   from returns.io import IOResultE, impure_safe   def fetch_resource_size(     client_get: Callable[[str], IOResultE[httpx.Response]],     url: str, ) -&gt; IOResultE[int]:     return client_get(url).map(         lambda response: len(response.content),     )   print(fetch_resource_size(     impure_safe(httpx.get),     'https:\/\/sobolevn.me', )) # =&gt; &lt;IOResult: &lt;Success: 27972&gt;&gt;<\/code><\/pre>\n<p>  \u041f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u043f\u0430\u0440\u0443 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<ul>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/returns.readthedocs.io\/en\/latest\/pages\/io.html\"><code>IOResultE<\/code><\/a> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e IO (<a href=\"https:\/\/habr.com\/ru\/company\/oleg-bunin\/blog\/445234\/\">\u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442<\/a>). \u0422\u0438\u043f\u044b, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 <code>Result<\/code>, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0438\u043c\u0438\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 <code>Failure()<\/code>. \u0423\u0441\u043f\u0435\u0448\u043d\u044b\u0435 \u0432\u044b\u0445\u043e\u0434\u044b \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u0442\u0438\u043f <code>Success<\/code>. \u041e\u0431\u044b\u0447\u043d\u043e \u043d\u0438\u043a\u043e\u043c\u0443 \u043d\u0435\u0442 \u0434\u0435\u043b\u0430 \u0434\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439, \u0430 \u043d\u0430\u043c \u0435\u0441\u0442\u044c.<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <a href=\"https:\/\/github.com\/encode\/httpx\/\"><code>httpx<\/code><\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u043c\u0438.<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <a href=\"https:\/\/returns.readthedocs.io\/en\/latest\/pages\/io.html#impure-safe\"><code>impure_safe<\/code><\/a>, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u0442\u0438\u043f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>httpx.get<\/code>, \u0432 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e <code>IOResultE<\/code>.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0410\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442<\/h3>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0451 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435.<\/p>\n<pre><code class=\"python\">from typing import Callable   import anyio import httpx   from returns.future import FutureResultE, future_safe   def fetch_resource_size(     client_get: Callable[[str], FutureResultE[httpx.Response]],     url: str, ) -&gt; FutureResultE[int]:     return client_get(url).map(         lambda response: len(response.content),     )   page_size = fetch_resource_size(     future_safe(httpx.AsyncClient().get),     'https:\/\/sobolevn.me', ) print(page_size) print(anyio.run(page_size.awaitable)) # =&gt; &lt;FutureResult: &lt;coroutine object async_map at 0x10b17c320&gt;&gt; # =&gt; &lt;IOResult: &lt;Success: 27972&gt;&gt;<\/code><\/pre>\n<p>  \u0412\u0438\u0434\u0438\u0442\u0435: \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0430\u0441\u044c. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0432\u043e\u0442 \u043d\u0430 \u0447\u0442\u043e:<\/p>\n<ul>\n<li>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 <code>IOResultE<\/code> \u0438\u0437\u043c\u0435\u043d\u0438\u043b\u0441\u044f \u043d\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 <a href=\"https:\/\/returns.readthedocs.io\/en\/latest\/pages\/future.html\"><code>FutureResultE<\/code><\/a>, <code>impure_safe<\/code> \u2014 \u043d\u0430 <a href=\"https:\/\/returns.readthedocs.io\/en\/latest\/pages\/future.html#future-safe\"><code>future_safe<\/code><\/a>. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a \u0436\u0435, \u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0443\u044e \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e: <code>FutureResultE<\/code>.<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <code>AsyncClient<\/code> \u0438\u0437 <code>httpx<\/code>.<\/li>\n<li>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <code>FutureResult<\/code> \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043a\u0440\u0430\u0441\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0441\u0430\u043c\u0438 \u0441\u0435\u0431\u044f.<\/li>\n<li>\u0423\u0442\u0438\u043b\u0438\u0442\u0430 <a href=\"https:\/\/github.com\/agronholm\/anyio\"><code>anyio<\/code><\/a> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043f\u043e\u0434\u0445\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043b\u044e\u0431\u043e\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439: <code>asyncio<\/code>, <code>trio<\/code>, <code>curio<\/code>.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0414\u0432\u0430 \u0432 \u043e\u0434\u043d\u043e\u043c<\/h3>\n<p>  \u041f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u0432 \u043e\u0434\u043d\u043e\u043c \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c API.<\/p>\n<p>  <a href=\"https:\/\/github.com\/dry-python\/returns\/blob\/master\/returns\/primitives\/hkt.py\">Higher Kinded Types<\/a> \u0438 <a href=\"https:\/\/github.com\/dry-python\/returns\/blob\/master\/returns\/interfaces\/specific\/ioresult.py\">type-class<\/a> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 IO \u0435\u0449\u0451 \u043d\u0435 \u0432\u044b\u0448\u043b\u0438 \u0432 \u0440\u0435\u043b\u0438\u0437 (\u043e\u043d\u0438 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u0432 0.15.0), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0438\u0440\u0443\u044e \u043d\u0430 \u043e\u0431\u044b\u0447\u043d\u043e\u043c <code>@overload<\/code>:<\/p>\n<pre><code class=\"python\">from typing import Callable, Union, overload   import anyio import httpx   from returns.future import FutureResultE, future_safe from returns.io import IOResultE, impure_safe   @overload def fetch_resource_size(     client_get: Callable[[str], IOResultE[httpx.Response]],     url: str, ) -&gt; IOResultE[int]:     &quot;&quot;&quot;Sync case.&quot;&quot;&quot;   @overload def fetch_resource_size(     client_get: Callable[[str], FutureResultE[httpx.Response]],     url: str, ) -&gt; FutureResultE[int]:     &quot;&quot;&quot;Async case.&quot;&quot;&quot;   def fetch_resource_size(     client_get: Union[         Callable[[str], IOResultE[httpx.Response]],         Callable[[str], FutureResultE[httpx.Response]],     ],     url: str, ) -&gt; Union[IOResultE[int], FutureResultE[int]]:     return client_get(url).map(         lambda response: len(response.content),     )<\/code><\/pre>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u043e\u0432 <code>@overload<\/code> \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c, \u043a\u0430\u043a\u0438\u0435 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u044b \u0438 \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0442\u0438\u043f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0434\u0435\u043a\u043e\u0440\u0430\u0442\u043e\u0440\u0435 <code>@overload<\/code> \u043c\u043e\u0436\u043d\u043e \u0432 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u043e\u0435\u0439 <a href=\"https:\/\/sobolevn.me\/2019\/01\/simple-dependent-types-in-python\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>  \u0412\u044b\u0437\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c \u0438\u043b\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u043e\u043c \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\"># Sync: print(fetch_resource_size(     impure_safe(httpx.get),     'https:\/\/sobolevn.me', )) # =&gt; &lt;IOResult: &lt;Success: 27972&gt;&gt;   # Async: page_size = fetch_resource_size(     future_safe(httpx.AsyncClient().get),     'https:\/\/sobolevn.me', ) print(page_size) print(anyio.run(page_size.awaitable)) # =&gt; &lt;FutureResult: &lt;coroutine object async_map at 0x10b17c320&gt;&gt; # =&gt; &lt;IOResult: &lt;Success: 27972&gt;&gt;<\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, <code>fetch_resource_size<\/code> \u0432 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0441\u0440\u0430\u0437\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <code>IOResult<\/code> \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0435\u0433\u043e. \u0412 \u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043a\u0430\u043a \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f event-loop, \u043a\u0430\u043a \u0434\u043b\u044f \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b. <code>anyio<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432.<\/p>\n<p>  \u0423 <code>mypy<\/code> \u043a \u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434\u0443 \u043d\u0438\u043a\u0430\u043a\u0438\u0445 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0439 \u043d\u0435\u0442:<\/p>\n<pre><code class=\"python\">\u00bb mypy async_and_sync.py Success: no issues found in 1 source file<\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442, \u0435\u0441\u043b\u0438 \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u0441\u043f\u043e\u0440\u0442\u0438\u0442\u044c.<\/p>\n<pre><code class=\"python\">---lambda response: len(response.content), +++lambda response: response.content,<\/code><\/pre>\n<p>  <code>mypy<\/code> \u043b\u0435\u0433\u043a\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u043d\u043e\u0432\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<pre><code class=\"python\">\u00bb mypy async_and_sync.py async_and_sync.py:33: error: Argument 1 to &quot;map&quot; of &quot;IOResult&quot; has incompatible type &quot;Callable[[Response], bytes]&quot;; expected &quot;Callable[[Response], int]&quot; async_and_sync.py:33: error: Argument 1 to &quot;map&quot; of &quot;FutureResult&quot; has incompatible type &quot;Callable[[Response], bytes]&quot;; expected &quot;Callable[[Response], int]&quot; async_and_sync.py:33: error: Incompatible return value type (got &quot;bytes&quot;, expected &quot;int&quot;)<\/code><\/pre>\n<p>  \u041b\u043e\u0432\u043a\u043e\u0441\u0442\u044c \u0440\u0443\u043a \u0438 \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043c\u0430\u0433\u0438\u0438: \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434 \u0441 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c\u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f\u043c\u0438, \u043d\u0443\u0436\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0440\u0430\u044f \u0434\u043e\u0431\u0440\u0430\u044f \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f. \u0410 \u0432\u043e\u0442 \u0442\u043e, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 API \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432, \u2014 \u043f\u043e-\u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u043c\u0443 \u0437\u0434\u043e\u0440\u043e\u0432\u043e. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u044d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441\u044b: \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0438\u043b\u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e.<\/p>\n<p>  \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u044d\u0442\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u0434\u043e\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a\u0438\u043c\u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043a\u043b\u0430\u0441\u0441\u043d\u044b\u043c\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0410 \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u0442\u0435 <a href=\"https:\/\/github.com\/dry-python\/returns\">dry-python\/returns<\/a>, \u0442\u043e \u043d\u0430\u0439\u0434\u0435\u0442\u0435 \u0435\u0449\u0435 \u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0433\u043e. \u0412 \u043d\u043e\u0432\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043c\u044b \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u044b \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Higher Kinded Types \u0438 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b. \u041a\u043e\u0434 \u0432\u044b\u0448\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">from typing import Callable, TypeVar  import anyio import httpx  from returns.future import future_safe from returns.interfaces.specific.ioresult import IOResultLike2 from returns.io import impure_safe from returns.primitives.hkt import Kind2, kinded  _IOKind = TypeVar('_IOKind', bound=IOResultLike2)  @kinded def fetch_resource_size(     client_get: Callable[[str], Kind2[_IOKind, httpx.Response, Exception]],     url: str, ) -&gt; Kind2[_IOKind, int, Exception]:     return client_get(url).map(         lambda response: len(response.content),     )   # Sync: print(fetch_resource_size(     impure_safe(httpx.get),     'https:\/\/sobolevn.me', )) # =&gt; &lt;IOResult: &lt;Success: 27972&gt;&gt;  # Async: page_size = fetch_resource_size(     future_safe(httpx.AsyncClient().get),     'https:\/\/sobolevn.me', ) print(page_size) print(anyio.run(page_size.awaitable)) # =&gt; &lt;FutureResult: &lt;coroutine object async_map at 0x10b17c320&gt;&gt; # =&gt; &lt;IOResult: &lt;Success: 27972&gt;&gt;<\/code><\/pre>\n<p>  \u0421\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0432\u0435\u0442\u043a\u0443 `master`, \u0442\u0430\u043c \u044d\u0442\u043e \u0443\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h2>\u0411\u043e\u043b\u044c\u0448\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 dry-python<\/h2>\n<p>  \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u0444\u0438\u0447\u0430\u0445 dry-python, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0433\u043e\u0440\u0436\u0443\u0441\u044c.<\/p>\n<ul>\n<li><strong>\u0422\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <\/strong><a href=\"https:\/\/returns.readthedocs.io\/en\/latest\/pages\/curry.html\"><code>partial<\/code> \u0438 <code>@curry<\/code><\/a>.<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"python\">from returns.curry import curry, partial   def example(a: int, b: str) -&gt; float:     ...   reveal_type(partial(example, 1)) # note: Revealed type is 'def (b: builtins.str) -&gt; builtins.float'   reveal_type(curry(example)) # note: Revealed type is 'Overload(def (a: builtins.int) -&gt; def (b: builtins.str) -&gt; builtins.float, def (a: builtins.int, b: builtins.str) -&gt; builtins.float)'<\/code><\/pre>\n<p>  \u042d\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>@curry<\/code>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"python\">@curry def example(a: int, b: str) -&gt; float:     return float(a + len(b))   assert example(1, 'abc') == 4.0 assert example(1)('abc') == 4.0<\/code><\/pre>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/returns.readthedocs.io\/en\/latest\/pages\/pipeline.html\"><strong>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u044b<\/strong><\/a><strong> \u0441 \u0432\u044b\u0432\u043e\u0434\u043e\u043c \u0442\u0438\u043f\u043e\u0432.<\/strong><\/li>\n<\/ul>\n<p>  \u0417\u0430 \u0441\u0447\u0451\u0442 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u043e\u0433\u043e mypy-\u043f\u043b\u0430\u0433\u0438\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u044b, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0435 \u0442\u0438\u043f\u044b.<\/p>\n<pre><code class=\"python\">from returns.pipeline import flow assert flow(     [1, 2, 3],     lambda collection: max(collection),     lambda max_number: -max_number, ) == -3<\/code><\/pre>\n<p>  \u041e\u0431\u044b\u0447\u043d\u043e \u0432 \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043e\u0447\u0435\u043d\u044c \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043b\u044f\u043c\u0431\u0434\u0430\u043c\u0438, \u0438\u0437-\u0437\u0430 \u0442\u043e\u0433\u043e \u0447\u0442\u043e \u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u0442\u0438\u043f\u0430 <code>Any<\/code>. \u0412\u044b\u0432\u043e\u0434 <code>mypy<\/code> \u0440\u0435\u0448\u0430\u0435\u0442 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443.<\/p>\n<p>  \u0421 \u0435\u0433\u043e \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0430\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0447\u0442\u043e <code>lambda collection: max(collection)<\/code> \u0442\u0438\u043f\u0430 <code>Callable[[List[int]], int]<\/code>, \u0430 <code>lambda max_number: -max_number<\/code> \u043f\u0440\u043e\u0441\u0442\u043e <code>Callable[[int], int]<\/code>. \u0412\u043e <code>flow<\/code> \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043b\u044e\u0431\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0438 \u0432\u0441\u0435 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u0412\u0441\u0451 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043f\u043b\u0430\u0433\u0438\u043d\u0443.<\/p>\n<ul>\n<li><a href=\"https:\/\/returns.readthedocs.io\/en\/latest\/pages\/context.html#requirescontextfutureresult-container\"><code>RequiresContextFutureResult<\/code><\/a><strong> \u0434\u043b\u044f <\/strong><a href=\"https:\/\/sobolevn.me\/2020\/02\/typed-functional-dependency-injection\"><strong>\u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0438\u043d\u044a\u0435\u043a\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/strong><\/a>.<\/li>\n<\/ul>\n<p>  \u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044e \u043d\u0430\u0434 <code>FutureResult<\/code>, \u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u0440\u0430\u043d\u0435\u0435, \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u044f\u0432\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u043c \u0441\u0442\u0438\u043b\u0435.<\/p>\n<h2>\u041f\u043b\u0430\u043d\u044b \u043d\u0430 \u0431\u0443\u0434\u0443\u0449\u0435\u0435<\/h2>\n<p>  \u041f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u0432\u044b\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0435\u0440\u0441\u0438\u044e 1.0, \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u0438\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0436\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447:<\/p>\n<ul>\n<li>\u0420\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c Higher Kinded Types \u0438\u043b\u0438 \u0438\u0445 \u044d\u043c\u0443\u043b\u044f\u0446\u0438\u044e (<a href=\"https:\/\/github.com\/dry-python\/returns\/issues\/408\">issue<\/a>).<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 type-\u043a\u043b\u0430\u0441\u0441\u044b, \u0447\u0442\u043e\u0431\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 (<a href=\"https:\/\/github.com\/dry-python\/classes\">issue<\/a>).<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 <code>mypyc<\/code>, \u0447\u0442\u043e \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 Python-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0432 \u0434\u0432\u043e\u0438\u0447\u043d\u044b\u0439 \u0444\u0430\u0439\u043b. \u0422\u043e\u0433\u0434\u0430 \u043a\u043e\u0434 \u0441 <code>dry-python\/returns<\/code> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 (<a href=\"https:\/\/github.com\/dry-python\/returns\/issues\/398\">issue<\/a>).<\/li>\n<li>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 Python, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <a href=\"https:\/\/github.com\/dry-python\/returns\/issues\/392\">\u00abdo-notation\u00bb<\/a>.<\/li>\n<\/ul>\n<p>  <\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u0438 \u0438 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0448\u0438\u0442\u044c \u043b\u044e\u0431\u0443\u044e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438, \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0446\u0432\u0435\u0442\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439, \u0447\u0438\u0442\u0430\u0435\u043c\u044b\u0439 \u0438 \u0433\u0438\u0431\u043a\u0438\u0439 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0418 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<p>  \u041f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 <a href=\"https:\/\/github.com\/dry-python\/returns\">dry-python\/returns<\/a> \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0439\u0442\u0435\u0441\u044c \u043a <a href=\"https:\/\/conf.python.ru\/moscow\/2020\">Russian Python Week<\/a>: \u043d\u0430 \u043a\u043e\u043d\u0444\u0435\u0440\u0435\u043d\u0446\u0438\u0438 core-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a dry-python Pablo Aguilar \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u0442 <a href=\"https:\/\/conf.python.ru\/moscow\/2020\/abstracts\/7006\">\u0432\u043e\u0440\u043a\u0448\u043e\u043f<\/a> \u043f\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044e dry-python \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438.<\/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\/company\/oleg-bunin\/blog\/512650\/\"> https:\/\/habr.com\/ru\/company\/oleg-bunin\/blog\/512650\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/company\/oleg-bunin\/blog\/512650\/\">\u0412 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0435 \u0441\u043b\u043e\u0432\u043e <code>async<\/code> \u0438 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u043d\u0438\u043a\u043b\u0430 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/JavaScript\/Reference\/Statements\/async_function\">JavaScript<\/a>, <a href=\"https:\/\/doc.rust-lang.org\/std\/keyword.async.html\">Rust<\/a>, <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/csharp\/language-reference\/operators\/await\">C#<\/a>, \u0438 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Async\/await\">\u043c\u043d\u043e\u0433\u0438\u0435 \u0434\u0440\u0443\u0433\u0438\u0435<\/a>. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432 Python \u0442\u043e\u0436\u0435 \u0435\u0441\u0442\u044c <code>async\/await<\/code>, \u043e\u043d\u0438 \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0432 Python 3.5.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u043e\u0431\u0441\u0443\u0434\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u043f\u043e\u0440\u0430\u0441\u0441\u0443\u0436\u0434\u0430\u0442\u044c \u043e\u0431 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430\u0445 \u0438 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435, \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.  <\/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-307645","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307645","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=307645"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307645\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307645"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307645"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307645"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}