{"id":470532,"date":"2025-08-13T15:00:20","date_gmt":"2025-08-13T15:00:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=470532"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=470532","title":{"rendered":"<span>XTools-py \u2014 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0435 \u0443\u0442\u0438\u043b\u0438\u0442\u044b \u0434\u043b\u044f Python-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e \u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0430 Python \u0438 \u043b\u043e\u0432\u0438\u043b\u0438 \u0441\u0435\u0431\u044f \u043d\u0430 \u043c\u044b\u0441\u043b\u0438 <em>\u00ab\u041e\u043f\u044f\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0430\u0440\u0441\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438\u2026\u00bb<\/em> \u0438\u043b\u0438 <em>\u00ab\u0413\u0434\u0435-\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b \u043a\u043e\u0434 \u043a\u0435\u0448\u0430, \u043d\u0430\u0434\u043e \u043d\u0430\u0439\u0442\u0438\u00bb<\/em> \u2014 \u044d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0432\u0430\u0441.<\/p>\n<p><strong>XTools-py<\/strong> \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u043c\u043e\u0449\u043d\u044b\u0445 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443.<br \/> \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u0435 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p><strong> \ud83d\udce6 \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430:<\/strong><\/p>\n<pre><code class=\"bash\">pip install xtools-py<\/code><\/pre>\n<h3>\u2728 \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/h3>\n<ul>\n<li>\n<p><strong>Find<\/strong> \u2014 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>Matrix<\/strong> \u2014 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>Config<\/strong> \u2014 \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 JSON, YAML, INI.<\/p>\n<\/li>\n<li>\n<p><strong>Validator<\/strong> \u2014 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a, \u0447\u0438\u0441\u0435\u043b \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>Cache<\/strong> \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u0435\u0448 \u0441 TTL.<\/p>\n<\/li>\n<li>\n<p><strong>DateTimeUtils<\/strong> \u2014 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>MathUtils<\/strong> \u2014 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>ColorUtils<\/strong> \u2014 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0446\u0432\u0435\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>EncryptionUtils<\/strong> \u2014 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>TextUtils<\/strong> \u2014 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>UnitConverter<\/strong> \u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0435\u0434\u0438\u043d\u0438\u0446 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>AWS S3 <\/strong>\u2014 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 (\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\/\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e).<\/p>\n<\/li>\n<\/ul>\n<h3>\ud83d\udd0d \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u0417\u0430\u0434\u0430\u0447\u0430<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041e\u0431\u044b\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/p>\n<\/th>\n<th>\n<p align=\"left\">XTools-py<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 JSON\/YAML\/INI<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>json<\/code> + <code>pyyaml<\/code> + <code>configparser<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Config<\/strong> \u2014 \u0432\u0441\u0451 \u0432 \u043e\u0434\u043d\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0438 \u0447\u0438\u0441\u0435\u043b<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>pydantic<\/code> \u0438\u043b\u0438 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Validator<\/strong> \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u041a\u0435\u0448 \u0441 TTL<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>cachetools<\/code> \u0438\u043b\u0438 <code>functools.lru_cache<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Cache<\/strong> \u2014 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>datetime<\/code> + <code>dateutil<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>DateTimeUtils<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>ColorUtils<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>numpy<\/code> (\u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0437\u0430\u0434\u0430\u0447)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Matrix<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u0428\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>cryptography<\/code> + <code>hashlib<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>EncryptionUtils<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0435\u0434\u0438\u043d\u0438\u0446 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>UnitConverter<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\"> \u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 S3<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>boto3<\/code> \u0438\u043b\u0438 <code>aioboto3<\/code> <\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>S3Storage \/ AsyncS3Storage<\/strong> <\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\ud83d\udcd6 \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<h4>1. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439<\/h4>\n<pre><code class=\"python\">from xtools import Config  config = Config(\"config.json\") config.set(\"app.debug\", True) config.save()<\/code><\/pre>\n<h4>2. \u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<pre><code class=\"python\">from xtools import Find  data = [\"apple\", \"banana\", \"cherry\"] print(Find.get_max(data))  # banana<\/code><\/pre>\n<h4>3. \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<pre><code class=\"python\">from xtools import Validator  print(Validator.is_email(\"test@example.com\"))  # True print(Validator.is_int(\"123\"))                 # True<\/code><\/pre>\n<h4>4. \u041a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<pre><code class=\"python\">from xtools import Cache  cache = Cache() cache.set(\"key\", \"value\", ttl=60) print(cache.get(\"key\"))  # value<\/code><\/pre>\n<h4>5. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438<\/h4>\n<pre><code class=\"python\">from xtools.utils import DateTimeUtils  print(DateTimeUtils.current_timestamp()) print(DateTimeUtils.format_date(\"2025-02-08\", \"%d.%m.%Y\"))<\/code><\/pre>\n<p><strong>6. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0435\u0434\u0438\u043d\u0438\u0446 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f<\/strong><\/p>\n<pre><code class=\"python\">from xtools import UnitConverter  print(UnitConverter.celsius_to_fahrenheit(25))  # 77.0 print(UnitConverter.meters_to_kilometers(1000))  # 1.0<\/code><\/pre>\n<h4>5. \u0428\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<pre><code class=\"python\">from xtools import EncryptionUtils  key = EncryptionUtils.generate_key() encrypted = EncryptionUtils.encrypt(\"Hello, World!\", key) decrypted = EncryptionUtils.decrypt(encrypted, key)  print(encrypted) print(decrypted)  # Hello, World!<\/code><\/pre>\n<p><strong>8. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 AWS S3 (\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e)<\/strong><\/p>\n<pre><code class=\"python\">from xtools.storage import S3Storage  s3 = S3Storage(\"my-bucket\", \"ACCESS_KEY\", \"SECRET_KEY\")  # \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 s3.upload_file(\"local.txt\", \"remote.txt\")  # \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432 print(s3.list_files())<\/code><\/pre>\n<p><strong>8. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 AWS S3 (\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e)<\/strong><\/p>\n<pre><code class=\"python\">import asyncio from xtools.storage import AsyncS3Storage  async def main():     s3 = AsyncS3Storage(\"my-bucket\", \"ACCESS_KEY\", \"SECRET_KEY\")     await s3.upload_file(\"local.txt\", \"remote.txt\")     print(await s3.list_files())  asyncio.run(main())<\/code><\/pre>\n<h2>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/h2>\n<h3>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/h3>\n<p><strong>\u041c\u043e\u0434\u0443\u043b\u044c <\/strong><code><strong>Config<\/strong><\/code> \u0432 XTools-py \u2014 \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 JSON, YAML \u0438 INI, \u0434\u0430\u0451\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u00abdot-notation\u00bb, \u0443\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0444\u0430\u0439\u043b\u044b \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e. \u0418\u0434\u0435\u044f \u2014 \u0434\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u044b\u0439, \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u0443\u044e \u043e\u0431\u0432\u044f\u0437\u043a\u0443 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. <\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p><strong>\u0424\u0430\u0439\u043b <\/strong><code><strong>config.yml<\/strong><\/code><strong>:<\/strong><\/p>\n<pre><code class=\"yaml\">app:   debug: false database:   host: \"localhost\"   port: 5432   user: \"app\"   password: null<\/code><\/pre>\n<p><strong> \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c<\/strong><\/p>\n<pre><code class=\"python\">from xtools import Config  config = Config(\"config.yml\", defaults={\"app\": {\"debug\": True}}, env_prefix=\"XT__\") print(config.get(\"database.host\", \"127.0.0.1\"))  # localhost config.set(\"database.password\", \"supersecret\") config.save()<\/code><\/pre>\n<p> \u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f <\/p>\n<pre><code class=\"bash\">export XT__DATABASE__HOST=prod.db.example export XT__APP__DEBUG=true<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u0438 <code>config.update_from_env(\"XT__\")<\/code> \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. <\/p>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u00a0\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 <\/strong><\/p>\n<pre><code class=\"python\">with Config(\"config.json\", create=True) as cfg:     cfg.set(\"app.version\", \"1.2.0\") # \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 with \u2014 cfg.save() \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438<\/code><\/pre>\n<p><strong>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 Validator<\/strong> <\/p>\n<pre><code class=\"python\">from xtools import Config, Validator  cfg = Config(\"config.yml\") port = cfg.get(\"database.port\") if not Validator.is_int(port):     raise ValueError(\"Bad port in config\")<\/code><\/pre>\n<h3>\u041f\u043e\u0438\u0441\u043a \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u041a\u043b\u0430\u0441\u0441 <strong>Find<\/strong> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0441\u043f\u0438\u0441\u043a\u0430\u0445, \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u0445, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0440\u043e\u043a\u0430\u0445. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0433\u0438\u0431\u043a\u0443\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e, \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c, \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. <\/p>\n<p><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u043b\u0438\u043d\u043d\u043e\u0439<\/strong><\/p>\n<pre><code class=\"python\">from XTools import Find  # \u041f\u0440\u0438\u043c\u0435\u0440 1: \u043e\u0434\u0438\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u0438\u0441\u0435\u043b print(Find.get_max([1, 3, 6])) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: {'max_number': 6}  # \u041f\u0440\u0438\u043c\u0435\u0440 2: \u0447\u0438\u0441\u043b\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a print(Find.get_max(['1', '3', '6'])) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: {'max_number': 6}  # \u041f\u0440\u0438\u043c\u0435\u0440 3: \u043f\u043e\u0438\u0441\u043a \u0441\u0430\u043c\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 print(Find.get_max(['hello', 'what is?', 'I using XTools'])) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: {'max_len': 'I using XTools'}  # \u041f\u0440\u0438\u043c\u0435\u0440 4: \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u0432 print(Find.get_max([1, 3, 6], ['hello', 'what is?', 'I using XTools'])) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: {'max_number': 6, 'max_len': 'I using XTools'}<\/code><\/pre>\n<p><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0441\u043b\u043e\u0432\u0430\u0440\u0451\u043c<\/strong><\/p>\n<pre><code class=\"python\">from XTools import Find  data = [     {\"name\": \"Alice\", \"age\": 25},     {\"name\": \"Bob\", \"age\": 30},     {\"name\": \"Charlie\", \"age\": 25} ]  # \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e results = Find.by_key_value(data, \"age\", 25) print(results) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: # [{'name': 'Alice', 'age': 25}, {'name': 'Charlie', 'age': 25}]  # \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u043c\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e results = Find.contains(data, \"name\", \"Al\") print(results) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: # [{'name': 'Alice', 'age': 25}]<\/code><\/pre>\n<h3>\u041a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041a\u043b\u0430\u0441\u0441 <strong>Cache<\/strong> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b<\/strong><\/p>\n<pre><code class=\"python\">from xtools import Cache  cache = Cache(ttl = 60, max_size = 100) # ttl: int -&gt; \u0412\u0440\u0435\u043c\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 60 \u0441\u0435\u043a.) # max_size: int -&gt; \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u044d\u0448\u0430 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 100 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432).  cache.set(\"key\", \"value\") # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 = \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435  print(cache.get(\"key\"))  # value  cache.delete(\"key\") # \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u044b \u043f\u043e \u043a\u043b\u044e\u0447\u0443<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0435\u0439<\/strong><\/p>\n<pre><code class=\"python\">from xtools import Cache, Validator  cache = Cache(ttl = 60, max_size = 25) user_email = input(\"Enter you email &gt; \")  if Validator.is_email(user_email):   cache.set(\"user_email\", user_email)  # \u041f\u043e\u0441\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0435\u0448 user_email = cache.get(\"user_email\") print(f\"You email: {user_email}\")<\/code><\/pre>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<pre><code class=\"python\">from xtools import Cache  cache = Cache(ttl = 60, max_size = 25)  cache.size() # \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u043d\u043d\u044b \u0432\u0441\u0435\u0433\u043e \u043a\u0435\u0448\u0430  cache.clear() # \u041f\u043e\u043b\u043d\u0430\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/code><\/pre>\n<h3>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438<\/h3>\n<p> \u041a\u043b\u0430\u0441\u0441 <code><strong>DateTimeUtils<\/strong><\/code> \u2014 \u044d\u0442\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0432 Python. \u041e\u043d \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0431\u0430\u0437\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f <code>datetime<\/code> \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0430\u043a \u0431\u0430\u0437\u043e\u0432\u044b\u0435, \u0442\u0430\u043a \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438. <\/p>\n<p><strong>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u0430:<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0430\u0442\u044b \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/strong> \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u0445 (<code>get_now<\/code>, <code>get_today<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0432 \u0434\u0430\u0442\u0443<\/strong> \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e (<code>parse_date<\/code>, <code>format_date<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0434\u0430\u0442<\/strong> \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0434\u043d\u0435\u0439, \u0447\u0430\u0441\u043e\u0432, \u043c\u0438\u043d\u0443\u0442 (<code>+<\/code>, <code>-<\/code><strong>)<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u0442<\/strong> \u2014 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435, \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u0442\u0430\u043c\u0438 (<code>==<\/code>, <code>!=<\/code>, <code><sub>&gt;<\/sub><\/code>, <code><sub>&gt;=<\/sub><\/code>, <code><sub>&lt;<\/sub><\/code>, <code><sub>&lt;=<\/sub><\/code><strong>)<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u0442\u0430\u043c\u0438<\/strong> \u2014 \u0432 \u0434\u043d\u044f\u0445, \u0447\u0430\u0441\u0430\u0445, \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (<code>diff_days<\/code>, <code>diff_seconds<\/code>).<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u0442\u044b \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong><\/p>\n<pre><code class=\"python\">from xtools.utils import DateTimeUtils   now = DateTimeUtils.current_timestamp(timezone = 'Europe\/Moscow') # timezone: str -&gt; \u0412\u0435\u0440\u043d\u0443\u0442\u044c \u0434\u0430\u0442\u0443 \u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c \u0447\u0430\u0441\u043e\u0432\u043e\u043c \u043f\u043e\u044f\u0441\u0435. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - \u041c\u043e\u0441\u043a\u0432\u0430 (+3\u0447)  now_sf = DateTimeUtils.format_date(date = now, format_string = \"%d.%m.%Y\") # date: datetime -&gt; \u0414\u0430\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 datetime # format_string: str -&gt; \u0424\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u0434\u0430\u0442\u044b  print(now_sf) # 09.09.2025<\/code><\/pre>\n<p><strong>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0434\u0430\u0442\u044b \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u0438\u0446<\/strong><\/p>\n<pre><code class=\"python\">from xtools.utils import DateTimeUtils  DateTimeUtils.parse_date(date_string = \"09.08.2025\", format_string = \"%d.%m.%Y\")  # \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u0438\u0446 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0434\u0430\u0442\u0430\u043c\u0438 \u0432 \u0434\u043d\u044f\u0445.  old_date = DateTimeUtils.current_timestamp() # \u0434\u0430\u0442\u0430 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0430\u044f new_date = DateTimeUtils.current_timestamp() # \u0434\u0430\u0442\u0430 \u043d\u043e\u0432\u0430\u044f  res = DateTimeUtils.date_difference(old_date, now_date)  print(res) # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u0442\u0430\u043c\u0438 \u0432 \u0434\u043d\u044f\u0445.<\/code><\/pre>\n<p><strong>\u041e\u0442\u0441\u0447\u0451\u0442 \u043f\u0440\u043e\u0448\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/strong><\/p>\n<pre><code class=\"python\">from xtools.utils import DateTimeUtils  date = DateTimeUtils.get_now() - timedelta(hours=1) ago = DateTimeUtils.time_ago(date) # 1 \u0434\u043d \u043d\u0430\u0437\u0430\u0434  # \u0418\u041b\u0418, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u0433\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435:  ago = DateTimeUtils.time_ago(date, only_number=True) # 1_day<\/code><\/pre>\n<p> \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code><strong>only_number<\/strong><\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430: <\/p>\n<p><strong>\u2022<\/strong><code><strong>only_number=False<\/strong><\/code><strong> (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e)<\/strong> \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>\u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d<\/strong> \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. <\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong><\/p>\n<pre><code class=\"python\">DateTimeUtils.time_ago(DateTimeUtils.get_now() - timedelta(hours=1)) # \"1 \u0447 \u043d\u0430\u0437\u0430\u0434\"<\/code><\/pre>\n<p><strong>\u2022<\/strong><code><strong>only_number=True<\/strong><\/code> \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>\u0441\u0442\u0440\u043e\u0433\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/strong> \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u043b\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. <\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440: <\/strong><\/p>\n<pre><code class=\"python\">DateTimeUtils.time_ago(datetime.now() - timedelta(hours=1), only_number=True) # \u279c \"1_hour\" <\/code><\/pre>\n<p><strong>\u0421\u0442\u0440\u043e\u0433\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/strong><\/p>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\"><strong><em>\u0422\u0438\u043f<\/em><\/strong><\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"center\"><strong><em>\u041e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/em><\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong><em>\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/em><\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">justnow<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435 60 \u0441\u0435\u043a. \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 <code>\u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e<\/code>(<code>justnow<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">0_justnow<br \/>13_justnow<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">minute<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 60 \u0441\u0435\u043a, \u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 3600 \u0441\u0435\u043a., \u0442\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 <code>.. \u043c\u0438\u043d \u043d\u0430\u0437\u0430\u0434<\/code> (<code>minute<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">1_minute<br \/>15_minute<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">hour<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 3600 \u0441\u0435\u043a, \u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 86.400 \u0441\u0435\u043a., \u0442\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 <code>.. \u0447 \u043d\u0430\u0437\u0430\u0434<\/code> (<code>hour<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">3_hour<br \/>41_hour<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">day<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u0438 \u0447\u0430\u0441\u044b \u0438 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0434\u043d\u0438, \u0442\u043e\u0433\u0434\u0430  \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 <br \/><code>.. \u0434\u043d \u043d\u0430\u0437\u0430\u0434<\/code> (<code>day<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">3_day<br \/>29_day<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">month<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u0438 \u0434\u043d\u0438 \u0438 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u043c\u0435\u0441\u044f\u0446\u044b, \u0442\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442<br \/><code>.. \u043c\u0435\u0441 \u043d\u0430\u0437\u0430\u0434<\/code> (<code>month<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">1_month<br \/>8_month<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">year<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u0438 \u043c\u0435\u0441\u044f\u0446\u044b \u0438 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0433\u043e\u0434\u0430, \u0442\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442<br \/><code>.. \u0433 \u043d\u0430\u0437\u0430\u0434<\/code> (<code>year<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">1_year<br \/>3_year<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u041a\u043b\u0430\u0441\u0441 <code>DateTime<\/code> \u2014 \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <code>datetime.datetime<\/code>. \u041e\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0432\u0438\u0434\u0435: <strong>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u0442<\/strong>, <strong>\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0430\u044f \u0434\u0430\u0442\u0430<\/strong>, <strong>\u041d\u0430\u0441\u0442\u043e\u044f\u0449\u0430\u044f \u0434\u0430\u0442\u0430.<\/strong><\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b:<\/strong><\/p>\n<pre><code class=\"python\">from xtools.utils import DateTime  dt = DateTime(zone = 'Europe\/Moscow') # \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0437\u043e\u043d\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0430 \u043a\u0430\u043a \u041c\u0421\u041a +3\u0447 print(dt) # \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: None dt.now() - timedelta(hours=1) print(dt) # \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 2025-08-09 23:35:01.572607+03:00 dt.now() print(dt) # \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 2025-08-10 00:35:01.573608+03:00  # \u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u044b dt.now() - timedelta(hours=1) dt.now()  print(dt.prev) # \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 2025-08-09 23:35:01.572607+03:00 print(dt) # \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 2025-08-10 00:35:01.573608+03:00  # \u041f\u043e\u043b\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432: print(dt.results) # \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 2025-08-10 00:35:01.573608+03:00,                                # 2025-08-10 00:35:01.573608+03:00<\/code><\/pre>\n<p><strong>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u044e\u0442\u0441\u044f \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:<\/strong><\/p>\n<pre><code class=\"python\">from xtools.utils import DateTime  dt = DateTime() dt.now()  dt + timedelta(hours=1) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 2025-08-10 01:35:01.573608+03:00 # \u0418\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f: \u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (+) \u0438 \u0412\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 (-)  # \u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 dt_a, dt_b = DateTime().now(), DateTime().now()   dt_a - dt_b # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: 0:00:00, \u0442.\u043a \u0443 \u043d\u0430\u0441 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u0434\u0430\u0442\u044b # \u0418\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f: \u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 (+) \u0438 \u0412\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 (-)<\/code><\/pre>\n<p><strong>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f \u0438 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u0430:<\/strong><\/p>\n<pre><code class=\"python\">from xtools.utils import DateTime  dt_a, dt_b = DateTime().now(), DateTime().now()  dt_a &gt; dt_b  dt_a &lt; dt_b  # \u0418\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f: &gt; | &gt;= | &lt;= | &lt;  # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e \u0438\u043b\u0438 \u043d\u0435\u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e dt_a == dt_b dt_a != dt_b  # \u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 None  dt = DateTime() bool(dt) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: False, \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0432\u0435\u043d None  dt = DateTime().now() bool(dt) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: True, \u0442.\u043a \u0443\u0436\u0435 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/code><\/pre>\n<h3>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0446\u0432\u0435\u0442\u0430\u043c\u0438<\/h3>\n<p> \u041a\u043b\u0430\u0441\u0441 <code><strong>ColorUtils<\/strong><\/code> \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u0431\u043e\u0440 \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0445 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0446\u0432\u0435\u0442\u0430\u043c\u0438 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u0445 \u2014 HEX, RGB, HSL \u0438 \u0434\u0440. \u041e\u043d \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u043c\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u043c\u0438, \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0445 \u0446\u0432\u0435\u0442\u043e\u0432 \u0438 \u0438\u0445 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e, \u0447\u0442\u043e \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 UI, \u0433\u0440\u0430\u0444\u0438\u043a\u0438 \u0438\u043b\u0438 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 \u0434\u0430\u043d\u043d\u044b\u0445. <\/p>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>ColorUtils<\/code> \u043c\u043e\u0436\u043d\u043e:<\/p>\n<ul>\n<li>\n<p><strong>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0446\u0432\u0435\u0442\u0430<\/strong><br \/> \u041f\u0435\u0440\u0435\u0432\u043e\u0434 \u0438\u0437 HEX \u0432 RGB \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432 HSL\/HSV, \u0447\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 CSS, PIL, matplotlib \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0446\u0432\u0435\u0442\u0430<\/strong><br \/> \u0411\u044b\u0441\u0442\u0440\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0446\u0432\u0435\u0442\u043e\u0432\u0443\u044e \u043f\u0430\u043b\u0438\u0442\u0440\u0443 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0442\u0435\u043c \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>\u041c\u0435\u043d\u044f\u0442\u044c \u044f\u0440\u043a\u043e\u0441\u0442\u044c \u0438 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c<\/strong><br \/> \u041b\u0435\u0433\u043a\u043e \u043e\u0441\u0432\u0435\u0442\u043b\u044f\u0442\u044c \u0438\u043b\u0438 \u0437\u0430\u0442\u0435\u043c\u043d\u044f\u0442\u044c \u0446\u0432\u0435\u0442, \u043f\u043e\u0432\u044b\u0448\u0430\u0442\u044c \u0438\u043b\u0438 \u043f\u043e\u043d\u0438\u0436\u0430\u0442\u044c \u0435\u0433\u043e \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0442\u0442\u0435\u043d\u043a\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u0430<\/strong><br \/> \u041c\u0435\u0442\u043e\u0434\u044b \u0434\u043b\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u043e\u0433\u043e \u0446\u0432\u0435\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043e\u043a \u0432 \u043e\u0442\u0440\u0438\u0441\u043e\u0432\u043a\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u044b<\/strong><br \/> \u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043b\u0430\u0432\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u043e\u0432 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0446\u0432\u0435\u0442\u0430\u043c\u0438 \u0432 \u043d\u0443\u0436\u043d\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u0448\u0430\u0433\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/strong><\/p>\n<pre><code class=\"python\">from XTools import ColorUtils  # \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f HEX \u2192 RGB print(ColorUtils.hex_to_rgb(\"#FF5733\")) # (255, 87, 51)  # \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f RGB \u2192 HEX print(ColorUtils.rgb_to_hex((255, 87, 51))) # '#FF5733'  # \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e HEX-\u0446\u0432\u0435\u0442\u0430 print(ColorUtils.random_hex()) # '#3E9CFF'  # \u041e\u0441\u0432\u0435\u0442\u043b\u0435\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u0430 \u043d\u0430 20% print(ColorUtils.lighten(\"#FF5733\", 0.2)) # '#FF7A59'  # \u0421\u043c\u0435\u043d\u0430 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u0446\u0432\u0435\u0442\u0430 print(ColorUtils.saturate(\"#FF5733\", 0.2)) # '#ff5732'  # \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u0438\u0437 5 \u0446\u0432\u0435\u0442\u043e\u0432 print(ColorUtils.gradient(\"#FF5733\", \"#33FF57\", steps=5)) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: ['#FF5733', '#BF8044', '#80A955', '#40D266', '#33FF57']<\/code><\/pre>\n<h3>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0435\u0434\u0438\u043d\u0438\u0446 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041a\u043b\u0430\u0441\u0441 UnitConverter \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b:  \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b, \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u0438 \u043c\u0430\u0441\u0441\u044b. \u041e\u043d \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0444\u043e\u0440\u043c\u0443\u043b\u0430\u043c. \u0412\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0432 \u0432\u0438\u0434\u0435  @staticmethod, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440<\/p>\n<h4>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u043b\u0430\u0441\u0441\u0430<\/h4>\n<p><strong>1. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>celsius_to_fahrenheit(celsius: float)<\/strong><\/code> \u2014 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0443 \u0438\u0437 \u0433\u0440\u0430\u0434\u0443\u0441\u043e\u0432 \u0426\u0435\u043b\u044c\u0441\u0438\u044f \u0432 \u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430.<br \/> <strong>\u0424\u043e\u0440\u043c\u0443\u043b\u0430:<\/strong> <code>\u00b0F = \u00b0C \u00d7 9\/5 + 32<\/code><br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong> <code>25\u00b0C \u2192 77\u00b0F<\/code><\/p>\n<\/li>\n<li>\n<p><code><strong>fahrenheit_to_celsius(fahrenheit: float)<\/strong><\/code> \u2014 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437 \u0424\u0430\u0440\u0435\u043d\u0433\u0435\u0439\u0442\u0430 \u0432 \u0426\u0435\u043b\u044c\u0441\u0438\u0439.<br \/> <strong>\u0424\u043e\u0440\u043c\u0443\u043b\u0430:<\/strong> <code>\u00b0C = (\u00b0F - 32) \u00d7 5\/9<\/code><br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong> <code>77\u00b0F \u2192 25\u00b0C<\/code><\/p>\n<\/li>\n<\/ul>\n<p><strong>2. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u044f<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>meters_to_kilometers(meters: float)<\/strong><\/code> \u2014 \u0438\u0437 \u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u043a\u0438\u043b\u043e\u043c\u0435\u0442\u0440\u044b.<br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong> <code>1500 \u043c \u2192 1.5 \u043a\u043c<\/code><\/p>\n<\/li>\n<li>\n<p><code><strong>kilometers_to_meters(kilometers: float)<\/strong><\/code> \u2014 \u0438\u0437 \u043a\u0438\u043b\u043e\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u043c\u0435\u0442\u0440\u044b.<br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong> <code>1.5 \u043a\u043c \u2192 1500 \u043c<\/code><\/p>\n<\/li>\n<\/ul>\n<p><strong>3. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u043c\u0430\u0441\u0441\u044b<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>grams_to_kilograms(grams: float)<\/strong><\/code> \u2014 \u0438\u0437 \u0433\u0440\u0430\u043c\u043c\u043e\u0432 \u0432 \u043a\u0438\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong> <code>2500 \u0433 \u2192 2.5 \u043a\u0433<\/code><\/p>\n<\/li>\n<li>\n<p><code><strong>kilograms_to_grams(kilograms: float)<\/strong><\/code> \u2014 \u0438\u0437 \u043a\u0438\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u043e\u0432 \u0432 \u0433\u0440\u0430\u043c\u043c\u044b.<br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong> <code>2.5 \u043a\u0433 \u2192 2500 \u0433<\/code><\/p>\n<\/li>\n<\/ul>\n<p><strong>4. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>kmh_to_ms(kmh: float)<\/strong><\/code> \u2014 \u043f\u0435\u0440\u0435\u0432\u043e\u0434 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438\u0437 \u043a\u0438\u043b\u043e\u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0447\u0430\u0441 \u0432 \u043c\u0435\u0442\u0440\u044b \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<br \/> <strong>\u0424\u043e\u0440\u043c\u0443\u043b\u0430:<\/strong> <code>m\/s = km\/h \u00f7 3.6<\/code><br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong> <code>72 \u043a\u043c\/\u0447 \u2192 20 \u043c\/\u0441<\/code><\/p>\n<\/li>\n<li>\n<p><code><strong>ms_to_kmh(ms: float)<\/strong><\/code> \u2014 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437 \u043c\u0435\u0442\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 \u0432 \u043a\u0438\u043b\u043e\u043c\u0435\u0442\u0440\u044b \u0432 \u0447\u0430\u0441.<br \/> <strong>\u0424\u043e\u0440\u043c\u0443\u043b\u0430:<\/strong> <code>km\/h = m\/s \u00d7 3.6<\/code><br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong> <code>20 \u043c\/\u0441 \u2192 72 \u043a\u043c\/\u0447<\/code><\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/strong><\/p>\n<pre><code class=\"python\">from XTools import UnitConverter  print(UnitConverter.celsius_to_fahrenheit(0))     # 32.0 print(UnitConverter.fahrenheit_to_celsius(32))    # 0.0 print(UnitConverter.meters_to_kilometers(1500))   # 1.5 print(UnitConverter.grams_to_kilograms(2500))     # 2.5 print(UnitConverter.kmh_to_ms(36))  # 10.0 \u043c\/\u0441 print(UnitConverter.ms_to_kmh(10))  # 36.0 \u043a\u043c\/\u0447<\/code><\/pre>\n<h3> \u0428\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0414\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 <\/h3>\n<p> \u041a\u043b\u0430\u0441\u0441 <code><strong>EncryptionUtils<\/strong><\/code> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <code><strong>cryptography.fernet<\/strong><\/code>. \u041c\u0435\u0442\u043e\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u0435\u043d \u043a\u0430\u043a \u0434\u043b\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0438. <\/p>\n<h4>\u0424\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043a\u043b\u0430\u0441\u0441\u0430<\/h4>\n<p><strong>1. \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043a\u043b\u044e\u0447\u0430<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>generate_key()<\/strong><\/code> \u2014 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0439 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u044b\u0439 \u043a\u043b\u044e\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445.<br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong><\/p>\n<pre><code class=\"python\">key = EncryptionUtils.generate_key()<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><strong>2. \u0428\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>encrypt(data: str, key: bytes)<\/strong><\/code> \u2014 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u043a\u043b\u044e\u0447, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u043a\u0435 UTF-8.<br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong><\/p>\n<pre><code class=\"python\">encrypted = EncryptionUtils.encrypt(\"Hello World\", key)<\/code><\/pre>\n<\/li>\n<\/ul>\n<p><strong>3. \u0414\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<ul>\n<li>\n<p><code><strong>decrypt(data: str, key: bytes)<\/strong><\/code> \u2014 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 \u0437\u0430\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u043a\u043b\u044e\u0447, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u0442\u0435\u043a\u0441\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a\u0438.<br \/> <strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong><\/p>\n<pre><code class=\"python\">decrypted = EncryptionUtils.decrypt(encrypted, key)<\/code><\/pre>\n<\/li>\n<\/ul>\n<h4>\u041f\u0440\u0438\u043d\u0446\u0438\u043f \u0440\u0430\u0431\u043e\u0442\u044b<\/h4>\n<ul>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f <strong>Fernet<\/strong> \u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u043e\u0433\u043e \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0435\u0439 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u044e\u0447 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f \u0432 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f).<\/p>\n<\/li>\n<li>\n<p>\u0411\u0435\u0437 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u043a\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u0430.<\/p>\n<\/li>\n<\/ul>\n<h3> \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 S3-\u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430\u043c\u0438<\/h3>\n<p> \u041a\u043b\u0430\u0441\u0441\u044b <code><strong>S3Storage<\/strong><\/code> (\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f) \u0438 <code><strong>AsyncS3Storage<\/strong><\/code> (\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f) \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 <strong>AWS S3<\/strong> \u0438 S3-\u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u044b\u043c\u0438 \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u043c\u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430\u043c\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, MinIO, Yandex Object Storage, DigitalOcean Spaces). \u041e\u043d\u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 \u043f\u043e\u043b\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0431\u0430\u0437\u043e\u0432\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438: <strong>\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430<\/strong>, <strong>\u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435<\/strong>, <strong>\u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435<\/strong> \u0438 <strong>\u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430<\/strong> \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u0431\u0430\u043a\u0435\u0442\u0435. <\/p>\n<h4>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438:<\/h4>\n<ol>\n<li>\n<p><strong>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432<\/strong><\/p>\n<ul>\n<li>\n<p><code>upload_file(file_path, s3_key)<\/code> \u2014 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0431\u0430\u043a\u0435\u0442 \u0441 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u043c \u043a\u043b\u044e\u0447\u043e\u043c (\u043f\u0443\u0442\u0435\u043c \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435).<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432<\/strong><\/p>\n<ul>\n<li>\n<p><code>download_file(s3_key, file_path)<\/code> \u2014 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0444\u0430\u0439\u043b \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0435\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432<\/strong><\/p>\n<ul>\n<li>\n<p><code>delete_file(s3_key)<\/code> \u2014 \u0443\u0434\u0430\u043b\u044f\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442 \u043f\u043e \u043a\u043b\u044e\u0447\u0443.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>\u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432<\/strong><\/p>\n<ul>\n<li>\n<p><code>list_files()<\/code> \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u0431\u0430\u043a\u0435\u0442\u0435.<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n<h4>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438<\/h4>\n<ul>\n<li>\n<p><code>AsyncS3Storage<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <code>aioboto3<\/code>, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, FastAPI, aiohttp).<\/p>\n<\/li>\n<li>\n<p>\u0421\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 <code>S3Storage<\/code> \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432, \u0443\u0442\u0438\u043b\u0438\u0442 \u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0431\u0435\u0437 async\/await.<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/strong><\/p>\n<pre><code class=\"python\">s3 = S3Storage(\"my-bucket\", \"ACCESS_KEY\", \"SECRET_KEY\")  # \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 s3.upload_file(\"local.txt\", \"folder\/remote.txt\")  # \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 s3.download_file(\"folder\/remote.txt\", \"downloaded.txt\")  # \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435 s3.delete_file(\"folder\/remote.txt\")  # \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u043f\u0438\u0441\u043a\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 print(s3.list_files())<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/strong><\/p>\n<pre><code class=\"python\">import asyncio  async def main():     s3 = AsyncS3Storage(\"my-bucket\", \"ACCESS_KEY\", \"SECRET_KEY\")      # \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430     await s3.upload_file(\"local.txt\", \"folder\/remote.txt\")      # \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435     await s3.download_file(\"folder\/remote.txt\", \"downloaded.txt\")      # \u0423\u0434\u0430\u043b\u0435\u043d\u0438\u0435     await s3.delete_file(\"folder\/remote.txt\")      # \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432     files = await s3.list_files()     print(files)  asyncio.run(main()) <\/code><\/pre>\n<h4>\ud83d\udca1 Roadmap<\/h4>\n<ul>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 <strong>Redis <\/strong>\u0434\u043b\u044f \u043a\u0435\u0448\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0420\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u0430\u044f \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041d\u043e\u0432\u044b\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<\/ul>\n<h4>\ud83d\udd17 \u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h4>\n<ul>\n<li>\n<p>\ud83d\udce6 PyPI: <a href=\"https:\/\/pypi.org\/project\/xtools-py\/\" rel=\"noopener noreferrer nofollow\">XTools-py<\/a><\/p>\n<\/li>\n<li>\n<p>\ud83d\udcbb GitHub: <a href=\"https:\/\/github.com\/SikWeet\/XTools-py\" rel=\"noopener noreferrer nofollow\">SikWeet\/XTools-py<\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><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\/articles\/936580\/\"> https:\/\/habr.com\/ru\/articles\/936580\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e \u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0430 Python \u0438 \u043b\u043e\u0432\u0438\u043b\u0438 \u0441\u0435\u0431\u044f \u043d\u0430 \u043c\u044b\u0441\u043b\u0438 <em>\u00ab\u041e\u043f\u044f\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0430\u0440\u0441\u0435\u0440 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438\u2026\u00bb<\/em> \u0438\u043b\u0438 <em>\u00ab\u0413\u0434\u0435-\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0431\u044b\u043b \u043a\u043e\u0434 \u043a\u0435\u0448\u0430, \u043d\u0430\u0434\u043e \u043d\u0430\u0439\u0442\u0438\u00bb<\/em> \u2014 \u044d\u0442\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0432\u0430\u0441.<\/p>\n<p><strong>XTools-py<\/strong> \u2014 \u044d\u0442\u043e \u043d\u0430\u0431\u043e\u0440 \u043c\u043e\u0449\u043d\u044b\u0445 \u0438 \u0443\u0434\u043e\u0431\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f Python, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438 \u0438 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443.<br \/> \u0412\u043c\u0435\u0441\u0442\u043e \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0442\u0440\u0430\u0442\u0438\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0438\u0435 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430, \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f.<\/p>\n<p><strong> \ud83d\udce6 \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430:<\/strong><\/p>\n<pre><code class=\"bash\">pip install xtools-py<\/code><\/pre>\n<h3>\u2728 \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438<\/h3>\n<ul>\n<li>\n<p><strong>Find<\/strong> \u2014 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0438 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044f\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<\/li>\n<li>\n<p><strong>Matrix<\/strong> \u2014 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>Config<\/strong> \u2014 \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 JSON, YAML, INI.<\/p>\n<\/li>\n<li>\n<p><strong>Validator<\/strong> \u2014 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a, \u0447\u0438\u0441\u0435\u043b \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0442\u0438\u043f\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>Cache<\/strong> \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043a\u0435\u0448 \u0441 TTL.<\/p>\n<\/li>\n<li>\n<p><strong>DateTimeUtils<\/strong> \u2014 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>MathUtils<\/strong> \u2014 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438.<\/p>\n<\/li>\n<li>\n<p><strong>ColorUtils<\/strong> \u2014 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0446\u0432\u0435\u0442\u043e\u0432.<\/p>\n<\/li>\n<li>\n<p><strong>EncryptionUtils<\/strong> \u2014 \u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<\/li>\n<li>\n<p><strong>TextUtils<\/strong> \u2014 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c.<\/p>\n<\/li>\n<li>\n<p><strong>UnitConverter<\/strong> \u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0435\u0434\u0438\u043d\u0438\u0446 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><strong>AWS S3 <\/strong>\u2014 \u043e\u0431\u043b\u0430\u0447\u043d\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 (\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\/\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e).<\/p>\n<\/li>\n<\/ul>\n<h3>\ud83d\udd0d \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430\u043c\u0438<\/h3>\n<div>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<th data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u0417\u0430\u0434\u0430\u0447\u0430<\/p>\n<\/th>\n<th>\n<p align=\"left\">\u041e\u0431\u044b\u0447\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435<\/p>\n<\/th>\n<th>\n<p align=\"left\">XTools-py<\/p>\n<\/th>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 JSON\/YAML\/INI<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>json<\/code> + <code>pyyaml<\/code> + <code>configparser<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Config<\/strong> \u2014 \u0432\u0441\u0451 \u0432 \u043e\u0434\u043d\u043e\u043c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0441\u0442\u0440\u043e\u043a \u0438 \u0447\u0438\u0441\u0435\u043b<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>pydantic<\/code> \u0438\u043b\u0438 \u0441\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Validator<\/strong> \u2014 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u041a\u0435\u0448 \u0441 TTL<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>cachetools<\/code> \u0438\u043b\u0438 <code>functools.lru_cache<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Cache<\/strong> \u2014 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u0442<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>datetime<\/code> + <code>dateutil<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>DateTimeUtils<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u0421\u0430\u043c\u043e\u043f\u0438\u0441\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>ColorUtils<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u043c\u0430\u0442\u0440\u0438\u0446\u0430\u043c\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>numpy<\/code> (\u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0437\u0430\u0434\u0430\u0447)<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>Matrix<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u0428\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0445\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>cryptography<\/code> + <code>hashlib<\/code><\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>EncryptionUtils<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\">\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0435\u0434\u0438\u043d\u0438\u0446 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f<\/p>\n<\/td>\n<td>\n<p align=\"left\">\u041e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438<\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>UnitConverter<\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"239\" width=\"239\">\n<p align=\"left\"> \u0425\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043e\u0431\u043b\u0430\u043a\u0435 S3<\/p>\n<\/td>\n<td>\n<p align=\"left\"><code>boto3<\/code> \u0438\u043b\u0438 <code>aioboto3<\/code> <\/p>\n<\/td>\n<td>\n<p align=\"left\"><strong>S3Storage \/ AsyncS3Storage<\/strong> <\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<\/div>\n<h3>\ud83d\udcd6 \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h3>\n<h4>1. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0435\u0439<\/h4>\n<pre><code class=\"python\">from xtools import Config  config = Config(\"config.json\") config.set(\"app.debug\", True) config.save()<\/code><\/pre>\n<h4>2. \u0411\u044b\u0441\u0442\u0440\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<pre><code class=\"python\">from xtools import Find  data = [\"apple\", \"banana\", \"cherry\"] print(Find.get_max(data))  # banana<\/code><\/pre>\n<h4>3. \u0412\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445<\/h4>\n<pre><code class=\"python\">from xtools import Validator  print(Validator.is_email(\"test@example.com\"))  # True print(Validator.is_int(\"123\"))                 # True<\/code><\/pre>\n<h4>4. \u041a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<pre><code class=\"python\">from xtools import Cache  cache = Cache() cache.set(\"key\", \"value\", ttl=60) print(cache.get(\"key\"))  # value<\/code><\/pre>\n<h4>5. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438<\/h4>\n<pre><code class=\"python\">from xtools.utils import DateTimeUtils  print(DateTimeUtils.current_timestamp()) print(DateTimeUtils.format_date(\"2025-02-08\", \"%d.%m.%Y\"))<\/code><\/pre>\n<p><strong>6. \u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0435\u0434\u0438\u043d\u0438\u0446 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f<\/strong><\/p>\n<pre><code class=\"python\">from xtools import UnitConverter  print(UnitConverter.celsius_to_fahrenheit(25))  # 77.0 print(UnitConverter.meters_to_kilometers(1000))  # 1.0<\/code><\/pre>\n<h4>5. \u0428\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0434\u0435\u0448\u0438\u0444\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h4>\n<pre><code class=\"python\">from xtools import EncryptionUtils  key = EncryptionUtils.generate_key() encrypted = EncryptionUtils.encrypt(\"Hello, World!\", key) decrypted = EncryptionUtils.decrypt(encrypted, key)  print(encrypted) print(decrypted)  # Hello, World!<\/code><\/pre>\n<p><strong>8. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 AWS S3 (\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e)<\/strong><\/p>\n<pre><code class=\"python\">from xtools.storage import S3Storage  s3 = S3Storage(\"my-bucket\", \"ACCESS_KEY\", \"SECRET_KEY\")  # \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0444\u0430\u0439\u043b\u0430 s3.upload_file(\"local.txt\", \"remote.txt\")  # \u0421\u043f\u0438\u0441\u043e\u043a \u0444\u0430\u0439\u043b\u043e\u0432 print(s3.list_files())<\/code><\/pre>\n<p><strong>8. \u0420\u0430\u0431\u043e\u0442\u0430 \u0441 AWS S3 (\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e)<\/strong><\/p>\n<pre><code class=\"python\">import asyncio from xtools.storage import AsyncS3Storage  async def main():     s3 = AsyncS3Storage(\"my-bucket\", \"ACCESS_KEY\", \"SECRET_KEY\")     await s3.upload_file(\"local.txt\", \"remote.txt\")     print(await s3.list_files())  asyncio.run(main())<\/code><\/pre>\n<h2>\u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/h2>\n<h3>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438<\/h3>\n<p><strong>\u041c\u043e\u0434\u0443\u043b\u044c <\/strong><code><strong>Config<\/strong><\/code> \u0432 XTools-py \u2014 \u044d\u0442\u043e \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438 \u043d\u0430\u0434\u0451\u0436\u043d\u044b\u0439 \u0441\u043b\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 JSON, YAML \u0438 INI, \u0434\u0430\u0451\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c \u0447\u0435\u0440\u0435\u0437 \u00abdot-notation\u00bb, \u0443\u043c\u0435\u0435\u0442 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0444\u0430\u0439\u043b\u044b \u0430\u0442\u043e\u043c\u0430\u0440\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u044c\u044e. \u0418\u0434\u0435\u044f \u2014 \u0434\u0430\u0442\u044c \u0435\u0434\u0438\u043d\u044b\u0439, \u043f\u0440\u043e\u0441\u0442\u043e\u0439 API, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u043d\u044b\u0445 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043d\u0435 \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u043d\u043e\u0442\u0438\u043f\u043d\u0443\u044e \u043e\u0431\u0432\u044f\u0437\u043a\u0443 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435. <\/p>\n<h4>\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f<\/h4>\n<p><strong>\u0424\u0430\u0439\u043b <\/strong><code><strong>config.yml<\/strong><\/code><strong>:<\/strong><\/p>\n<pre><code class=\"yaml\">app:   debug: false database:   host: \"localhost\"   port: 5432   user: \"app\"   password: null<\/code><\/pre>\n<p><strong> \u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0438 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c<\/strong><\/p>\n<pre><code class=\"python\">from xtools import Config  config = Config(\"config.yml\", defaults={\"app\": {\"debug\": True}}, env_prefix=\"XT__\") print(config.get(\"database.host\", \"127.0.0.1\"))  # localhost config.set(\"database.password\", \"supersecret\") config.save()<\/code><\/pre>\n<p> \u041f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f <\/p>\n<pre><code class=\"bash\">export XT__DATABASE__HOST=prod.db.example export XT__APP__DEBUG=true<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u0438 <code>config.update_from_env(\"XT__\")<\/code> \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0435\u0442 \u043d\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. <\/p>\n<p><strong>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u043a\u00a0\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 <\/strong><\/p>\n<pre><code class=\"python\">with Config(\"config.json\", create=True) as cfg:     cfg.set(\"app.version\", \"1.2.0\") # \u043f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u0437 with \u2014 cfg.save() \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438<\/code><\/pre>\n<p><strong>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f \u0441 Validator<\/strong> <\/p>\n<pre><code class=\"python\">from xtools import Config, Validator  cfg = Config(\"config.yml\") port = cfg.get(\"database.port\") if not Validator.is_int(port):     raise ValueError(\"Bad port in config\")<\/code><\/pre>\n<h3>\u041f\u043e\u0438\u0441\u043a \u0434\u0430\u043d\u043d\u044b\u0445<\/h3>\n<p>\u041a\u043b\u0430\u0441\u0441 <strong>Find<\/strong> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u0432 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043d \u0443\u043f\u0440\u043e\u0449\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0441\u043f\u0438\u0441\u043a\u0430\u0445, \u0441\u043b\u043e\u0432\u0430\u0440\u044f\u0445, \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430\u0445, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0441\u0442\u0440\u043e\u043a\u0430\u0445. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0433\u0438\u0431\u043a\u0443\u044e \u0444\u0438\u043b\u044c\u0442\u0440\u0430\u0446\u0438\u044e, \u043f\u043e\u0438\u0441\u043a \u043f\u043e \u043a\u043b\u044e\u0447\u0430\u043c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c, \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u0435 \u0438 \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u044b\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f. <\/p>\n<p><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u043b\u0438\u043d\u043d\u043e\u0439<\/strong><\/p>\n<pre><code class=\"python\">from XTools import Find  # \u041f\u0440\u0438\u043c\u0435\u0440 1: \u043e\u0434\u0438\u043d \u0441\u043f\u0438\u0441\u043e\u043a \u0447\u0438\u0441\u0435\u043b print(Find.get_max([1, 3, 6])) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: {'max_number': 6}  # \u041f\u0440\u0438\u043c\u0435\u0440 2: \u0447\u0438\u0441\u043b\u0430 \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u043e\u043a print(Find.get_max(['1', '3', '6'])) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: {'max_number': 6}  # \u041f\u0440\u0438\u043c\u0435\u0440 3: \u043f\u043e\u0438\u0441\u043a \u0441\u0430\u043c\u043e\u0439 \u0434\u043b\u0438\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 print(Find.get_max(['hello', 'what is?', 'I using XTools'])) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: {'max_len': 'I using XTools'}  # \u041f\u0440\u0438\u043c\u0435\u0440 4: \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u0432 print(Find.get_max([1, 3, 6], ['hello', 'what is?', 'I using XTools'])) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: {'max_number': 6, 'max_len': 'I using XTools'}<\/code><\/pre>\n<p><strong>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0441\u043b\u043e\u0432\u0430\u0440\u0451\u043c<\/strong><\/p>\n<pre><code class=\"python\">from XTools import Find  data = [     {\"name\": \"Alice\", \"age\": 25},     {\"name\": \"Bob\", \"age\": 30},     {\"name\": \"Charlie\", \"age\": 25} ]  # \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e results = Find.by_key_value(data, \"age\", 25) print(results) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: # [{'name': 'Alice', 'age': 25}, {'name': 'Charlie', 'age': 25}]  # \u041f\u043e\u0438\u0441\u043a \u043f\u043e \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e\u043c\u0443 \u0441\u043e\u0432\u043f\u0430\u0434\u0435\u043d\u0438\u044e results = Find.contains(data, \"name\", \"Al\") print(results) # \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: # [{'name': 'Alice', 'age': 25}]<\/code><\/pre>\n<h3>\u041a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h3>\n<p>\u041a\u043b\u0430\u0441\u0441 <strong>Cache<\/strong> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d \u0434\u043b\u044f \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u044b<\/strong><\/p>\n<pre><code class=\"python\">from xtools import Cache  cache = Cache(ttl = 60, max_size = 100) # ttl: int -&gt; \u0412\u0440\u0435\u043c\u044f \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 60 \u0441\u0435\u043a.) # max_size: int -&gt; \u041c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u044d\u0448\u0430 (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u2014 100 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432).  cache.set(\"key\", \"value\") # \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043a\u043b\u044e\u0447 = \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435  print(cache.get(\"key\"))  # value  cache.delete(\"key\") # \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0430\u0440\u044b \u043f\u043e \u043a\u043b\u044e\u0447\u0443<\/code><\/pre>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0435\u0439<\/strong><\/p>\n<pre><code class=\"python\">from xtools import Cache, Validator  cache = Cache(ttl = 60, max_size = 25) user_email = input(\"Enter you email &gt; \")  if Validator.is_email(user_email):   cache.set(\"user_email\", user_email)  # \u041f\u043e\u0441\u043b\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u0430\u043b\u044c\u0448\u0435 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0444\u0430\u0439\u043b\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0435\u0448 user_email = cache.get(\"user_email\") print(f\"You email: {user_email}\")<\/code><\/pre>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0438 \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/strong><\/p>\n<pre><code class=\"python\">from xtools import Cache  cache = Cache(ttl = 60, max_size = 25)  cache.size() # \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u0438\u043d\u043d\u044b \u0432\u0441\u0435\u0433\u043e \u043a\u0435\u0448\u0430  cache.clear() # \u041f\u043e\u043b\u043d\u0430\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0430 \u0432\u0441\u0435\u0445 \u0434\u0430\u043d\u043d\u044b\u0445<\/code><\/pre>\n<h3>\u0420\u0430\u0431\u043e\u0442\u0430 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438<\/h3>\n<p> \u041a\u043b\u0430\u0441\u0441 <code><strong>DateTimeUtils<\/strong><\/code> \u2014 \u044d\u0442\u043e \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442 \u0434\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0434\u0430\u0442\u0430\u043c\u0438 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0432 Python. \u041e\u043d \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0431\u0430\u0437\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f <code>datetime<\/code> \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0443\u0434\u043e\u0431\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0442 \u0431\u044b\u0441\u0442\u0440\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043a\u0430\u043a \u0431\u0430\u0437\u043e\u0432\u044b\u0435, \u0442\u0430\u043a \u0438 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0434\u0430\u0442\u0430\u043c\u0438. <\/p>\n<p><strong>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u043b\u0430\u0441\u0441\u0430:<\/strong><\/p>\n<ul>\n<li>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0430\u0442\u044b \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/strong> \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u0445 (<code>get_now<\/code>, <code>get_today<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a \u0432 \u0434\u0430\u0442\u0443<\/strong> \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e (<code>parse_date<\/code>, <code>format_date<\/code>).<\/p>\n<\/li>\n<li>\n<p><strong>\u0410\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0430 \u0434\u0430\u0442<\/strong> \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0434\u043d\u0435\u0439, \u0447\u0430\u0441\u043e\u0432, \u043c\u0438\u043d\u0443\u0442 (<code>+<\/code>, <code>-<\/code><strong>)<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u0442<\/strong> \u2014 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435, \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u0442\u0430\u043c\u0438 (<code>==<\/code>, <code>!=<\/code>, <code><sub>&gt;<\/sub><\/code>, <code><sub>&gt;=<\/sub><\/code>, <code><sub>&lt;<\/sub><\/code>, <code><sub>&lt;=<\/sub><\/code><strong>)<\/strong><\/p>\n<\/li>\n<li>\n<p><strong>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u0442\u0430\u043c\u0438<\/strong> \u2014 \u0432 \u0434\u043d\u044f\u0445, \u0447\u0430\u0441\u0430\u0445, \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 (<code>diff_days<\/code>, <code>diff_seconds<\/code>).<\/p>\n<\/li>\n<\/ul>\n<p><strong>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0434\u0430\u0442\u044b \u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/strong><\/p>\n<pre><code class=\"python\">from xtools.utils import DateTimeUtils   now = DateTimeUtils.current_timestamp(timezone = 'Europe\/Moscow') # timezone: str -&gt; \u0412\u0435\u0440\u043d\u0443\u0442\u044c \u0434\u0430\u0442\u0443 \u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u043c \u0447\u0430\u0441\u043e\u0432\u043e\u043c \u043f\u043e\u044f\u0441\u0435. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e - \u041c\u043e\u0441\u043a\u0432\u0430 (+3\u0447)  now_sf = DateTimeUtils.format_date(date = now, format_string = \"%d.%m.%Y\") # date: datetime -&gt; \u0414\u0430\u0442\u0430 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 datetime # format_string: str -&gt; \u0424\u043e\u0440\u043c\u0430\u0442 \u0434\u043b\u044f \u0434\u0430\u0442\u044b  print(now_sf) # 09.09.2025<\/code><\/pre>\n<p><strong>\u041f\u0430\u0440\u0441\u0438\u043d\u0433 \u0434\u0430\u0442\u044b \u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u0438\u0446<\/strong><\/p>\n<pre><code class=\"python\">from xtools.utils import DateTimeUtils  DateTimeUtils.parse_date(date_string = \"09.08.2025\", format_string = \"%d.%m.%Y\")  # \u0412\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u0438\u0446 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0434\u0430\u0442\u0430\u043c\u0438 \u0432 \u0434\u043d\u044f\u0445.  old_date = DateTimeUtils.current_timestamp() # \u0434\u0430\u0442\u0430 \u0443\u0441\u0442\u0430\u0440\u0435\u0432\u0448\u0430\u044f new_date = DateTimeUtils.current_timestamp() # \u0434\u0430\u0442\u0430 \u043d\u043e\u0432\u0430\u044f  res = DateTimeUtils.date_difference(old_date, now_date)  print(res) # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0435 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043c\u0435\u0436\u0434\u0443 \u0434\u0430\u0442\u0430\u043c\u0438 \u0432 \u0434\u043d\u044f\u0445.<\/code><\/pre>\n<p><strong>\u041e\u0442\u0441\u0447\u0451\u0442 \u043f\u0440\u043e\u0448\u0435\u0434\u043d\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/strong><\/p>\n<pre><code class=\"python\">from xtools.utils import DateTimeUtils  date = DateTimeUtils.get_now() - timedelta(hours=1) ago = DateTimeUtils.time_ago(date) # 1 \u0434\u043d \u043d\u0430\u0437\u0430\u0434  # \u0418\u041b\u0418, \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u0433\u043e\u043c \u0444\u043e\u0440\u043c\u0430\u0442\u0435:  ago = DateTimeUtils.time_ago(date, only_number=True) # 1_day<\/code><\/pre>\n<p> \u0410\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code><strong>only_number<\/strong><\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0444\u043e\u0440\u043c\u0430\u0442\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430: <\/p>\n<p><strong>\u2022<\/strong><code><strong>only_number=False<\/strong><\/code><strong> (\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e)<\/strong> \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>\u0433\u043e\u0442\u043e\u0432\u044b\u0439 \u0442\u0435\u043a\u0441\u0442\u043e\u0432\u044b\u0439 \u0448\u0430\u0431\u043b\u043e\u043d<\/strong> \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. <\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440:<\/strong><\/p>\n<pre><code class=\"python\">DateTimeUtils.time_ago(DateTimeUtils.get_now() - timedelta(hours=1)) # \"1 \u0447 \u043d\u0430\u0437\u0430\u0434\"<\/code><\/pre>\n<p><strong>\u2022<\/strong><code><strong>only_number=True<\/strong><\/code> \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>\u0441\u0442\u0440\u043e\u0433\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442<\/strong> \u0434\u043b\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u043b\u0438 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f. <\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0440: <\/strong><\/p>\n<pre><code class=\"python\">DateTimeUtils.time_ago(datetime.now() - timedelta(hours=1), only_number=True) # \u279c \"1_hour\" <\/code><\/pre>\n<p><strong>\u0421\u0442\u0440\u043e\u0433\u0438\u0439 \u0444\u043e\u0440\u043c\u0430\u0442, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435:<\/strong><\/p>\n<div class=\"table\">\n<table>\n<tbody>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\"><strong><em>\u0422\u0438\u043f<\/em><\/strong><\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"center\"><strong><em>\u041e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/em><\/strong><\/p>\n<\/td>\n<td>\n<p align=\"center\"><strong><em>\u041f\u0440\u0438\u043c\u0435\u0440\u044b<\/em><\/strong><\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">justnow<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u043e \u043c\u0435\u043d\u044c\u0448\u0435 60 \u0441\u0435\u043a. \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 <code>\u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0442\u043e<\/code>(<code>justnow<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">0_justnow<br \/>13_justnow<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">minute<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 60 \u0441\u0435\u043a, \u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 3600 \u0441\u0435\u043a., \u0442\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 <code>.. \u043c\u0438\u043d \u043d\u0430\u0437\u0430\u0434<\/code> (<code>minute<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">1_minute<br \/>15_minute<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">hour<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u043e \u0431\u043e\u043b\u044c\u0448\u0435 3600 \u0441\u0435\u043a, \u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 86.400 \u0441\u0435\u043a., \u0442\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 <code>.. \u0447 \u043d\u0430\u0437\u0430\u0434<\/code> (<code>hour<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">3_hour<br \/>41_hour<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">day<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u0438 \u0447\u0430\u0441\u044b \u0438 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0434\u043d\u0438, \u0442\u043e\u0433\u0434\u0430  \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442 <br \/><code>.. \u0434\u043d \u043d\u0430\u0437\u0430\u0434<\/code> (<code>day<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">3_day<br \/>29_day<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">month<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u0438 \u0434\u043d\u0438 \u0438 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u043c\u0435\u0441\u044f\u0446\u044b, \u0442\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442<br \/><code>.. \u043c\u0435\u0441 \u043d\u0430\u0437\u0430\u0434<\/code> (<code>month<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">1_month<br \/>8_month<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td data-colwidth=\"92\" width=\"92\">\n<p align=\"center\">year<\/p>\n<\/td>\n<td data-colwidth=\"491\" width=\"491\">\n<p align=\"left\">\u041f\u0440\u043e\u0448\u043b\u0438 \u043c\u0435\u0441\u044f\u0446\u044b \u0438 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u0433\u043e\u0434\u0430, \u0442\u043e\u0433\u0434\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0431\u0443\u0434\u0435\u0442<br \/><code>.. \u0433 \u043d\u0430\u0437\u0430\u0434<\/code> (<code>year<\/code>)<\/p>\n<\/td>\n<td>\n<p align=\"center\">1_year<br \/>3_year<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>\u041a\u043b\u0430\u0441\u0441 <code>DateTime<\/code> \u2014 \u044d\u0442\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 <code>datetime.datetime<\/code>. \u041e\u043d\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u044f \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0432\u0438\u0434\u0435: <strong>\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u0442<\/strong>, <strong><\/strong><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-470532","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/470532","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=470532"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/470532\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=470532"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=470532"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=470532"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}