{"id":456422,"date":"2025-04-17T15:01:06","date_gmt":"2025-04-17T15:01:06","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=456422"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=456422","title":{"rendered":"<span>\u041f\u0438\u0448\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u043d\u0430 python #1. \u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430<\/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>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u043d\u0430 Python \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 (\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0438 \u043c\u0430\u043b\u043e \u0447\u0435\u0433\u043e \u0443\u043c\u0435\u044e\u0449\u0435\u0439).<\/p>\n<p>#1 \u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 &#8212; \u0412\u044b \u0437\u0434\u0435\u0441\u044c<\/p>\n<p>#2 \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<p>#3 \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u043c\u0430\u043d\u0434<\/p>\n<p>#4 \u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b<\/p>\n<h2>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/h2>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430:<\/p>\n<pre><code>| pyterminal |-- filesystem.py |-- terminal.py |-- com_handler.py |-- apps |--- notepad.py |--- compiler.py |--- brainf.py |--- calculator.py |--- file_manager.py |--- browser.py<\/code><\/pre>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0448 \u0444\u0430\u0439\u043b \u044d\u0442\u043e filesystem.py.<\/p>\n<h2>\u041f\u0438\u0448\u0435\u043c \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0442\u0430\u043a\u0436\u0435 \u0434\u0438\u0441\u043a\u0430.<\/p>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<pre><code class=\"python\">try:   from dataclasses import * except:   #\u043d\u0438\u0436\u0435 3.7   raise SystemExit('\u0414\u0430\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043b\u0436\u0430 \u0431\u044b\u0442\u044c 3.7 \u0438 \u0432\u044b\u0448\u0435')<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0434\u0430\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0442\u043e \u044d\u0442\u043e python \u0432\u0435\u0440\u0441\u0438\u0438 3.6 \u0438 \u043d\u0438\u0436\u0435. \u0422\u0430\u043a \u0447\u0442\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<pre><code class=\"python\">class FSerror(Exception):   pass<\/code><\/pre>\n<p>\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043b\u0435\u0433\u043a\u043e \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"python\">#\u0442\u0443\u0442 \u0441\u0430\u043c\u0438 \u0444\u0430\u0439\u043b\u044b files = {}  @dataclass class File:   '''   \u041a\u043b\u0430\u0441\u0441 \u0444\u0430\u0439\u043b\u0430   name (str): \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430   text (any): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430   '''   name: str   text: str    def save(self):     files[self.name] = self.text<\/code><\/pre>\n<p>any &#8212; \u044d\u0442\u043e \u043b\u044e\u0431\u043e\u0439 \u0442\u0438\u043f<\/p>\n<p>save &#8212; \u043c\u0435\u0442\u043e\u0434 \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b<\/p>\n<p>name &#8212; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u043c\u0435\u043d\u0438<\/p>\n<p>text &#8212; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0433\u0434\u0435 \u0442\u0435\u043a\u0441\u0442<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0434\u0438\u0441\u043a\u0430:<\/p>\n<pre><code class=\"python\">class Disk:   '''   \u041a\u043b\u0430\u0441\u0441 \u0434\u0438\u0441\u043a\u0430   name (str): \u0438\u043c\u044f \u0434\u0438\u0441\u043a\u0430   '''   def __init__(self, name):     self.name = name     self.children = []    def add(self, file):     if file in files:       self.children.append(file)     else:       raise FSerror(f'\u0424\u0430\u0439\u043b \"{file}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')    def get(self, name):     if name in self.children:       return files[name]     raise FSerror(f'\u0424\u0430\u0439\u043b \"{name}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')    def delete(self, name):     if name in self.children:       del files[name]     raise FSerror(f'\u0424\u0430\u0439\u043b \"{name}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')  c = Disk('C:')<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0434\u0438\u0441\u043a. \u0418 \u044d\u0442\u043e \u0434\u0438\u0441\u043a &#171;C&#187;<\/p>\n<p>add &#8212; \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0432 \u0434\u0438\u0441\u043a<\/p>\n<p>get &#8212; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0432 \u0434\u0438\u0441\u043a\u0435<\/p>\n<p>delete &#8212; \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0444\u0430\u0439\u043b<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u044a\u044f\u0432\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>__all__<\/code> (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0439):<\/p>\n<pre><code class=\"python\">__all__ = ['File', 'files', 'c']<\/code><\/pre>\n<h2>\u0412\u0435\u0441\u044c \u043a\u043e\u0434.<\/h2>\n<pre><code class=\"python\">try:   from dataclasses import * except:   #\u043d\u0438\u0436\u0435 3.7   raise SystemExit('\u0414\u0430\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043b\u0436\u0430 \u0431\u044b\u0442\u044c 3.7 \u0438 \u0432\u044b\u0448\u0435')  class FSerror(Exception):   pass  #\u0442\u0443\u0442 \u0441\u0430\u043c\u0438 \u0444\u0430\u0439\u043b\u044b files = {}  @dataclass class File:   '''   \u041a\u043b\u0430\u0441\u0441 \u0444\u0430\u0439\u043b\u0430   name (str): \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430   text (str): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430   '''   name: str   text: str    def save(self):       files[self.name] = self.text  class Disk:   '''   \u041a\u043b\u0430\u0441\u0441 \u0434\u0438\u0441\u043a\u0430   name (str): \u0438\u043c\u044f \u0434\u0438\u0441\u043a\u0430   '''   def __init__(self, name):     self.name = name     self.children = []    def add(self, file):     if file in files:       self.children.append(file)     else:       raise FSerror(f'\u0424\u0430\u0439\u043b \"{file}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')    def get(self, name):     if name in self.children:       return files[name]     raise FSerror(f'\u0424\u0430\u0439\u043b \"{name}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')    def delete(self, name):     if name in self.children:       del files[name]     raise FSerror(f'\u0424\u0430\u0439\u043b \"{name}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')  c = Disk('C:')  __all__ = ['File', 'files', 'c']<\/code><\/pre>\n<p>\u0412\u0441\u0435\u0433\u043e 53 \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u043a\u043e\u0434\u0430. \u041e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h2>\u0418\u0442\u043e\u0433 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/h2>\n<p>\u041c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u043b\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"python\">#\u0432 PyShell &gt;&gt;&gt; hello = File('hello', '123') &gt;&gt;&gt; hello.save() &gt;&gt;&gt; c.add('hello') &gt;&gt;&gt; print(c.get('hello')) 123 &gt;&gt;&gt; c.delete('hello') &gt;&gt;&gt; print(c.get('hello')) Traceback (most recent call last):   File \"&lt;pyshell#2&gt;\", line 1, in &lt;module&gt;     print(c.get('hello'))   File \"C:\\Users\\DRA\\Desktop\\owner.py\", line 44, in get     raise FSerror(f'\u0424\u0430\u0439\u043b \"{name}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d') FSerror: \u0424\u0430\u0439\u043b \"hello\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d &gt;&gt;&gt; <\/code><\/pre>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442.<\/p>\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\/901814\/\"> https:\/\/habr.com\/ru\/articles\/901814\/<\/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>\u0412\u0441\u0435\u043c \u043f\u0440\u0438\u0432\u0435\u0442, \u0441\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u043d\u0430\u0447\u043d\u0451\u043c \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b \u043d\u0430 Python \u0441 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439 (\u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u0438 \u043c\u0430\u043b\u043e \u0447\u0435\u0433\u043e \u0443\u043c\u0435\u044e\u0449\u0435\u0439).<\/p>\n<p>#1 \u0424\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 &#8212; \u0412\u044b \u0437\u0434\u0435\u0441\u044c<\/p>\n<p>#2 \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/p>\n<p>#3 \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043a\u043e\u043c\u0430\u043d\u0434<\/p>\n<p>#4 \u0422\u0435\u0440\u043c\u0438\u043d\u0430\u043b<\/p>\n<h2>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435<\/h2>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u043d\u0430\u0445\u043e\u0434\u044f\u0442\u0441\u044f \u0444\u0430\u0439\u043b\u044b \u043d\u0430\u0448\u0435\u0433\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430:<\/p>\n<pre><code>| pyterminal |-- filesystem.py |-- terminal.py |-- com_handler.py |-- apps |--- notepad.py |--- compiler.py |--- brainf.py |--- calculator.py |--- file_manager.py |--- browser.py<\/code><\/pre>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0448 \u0444\u0430\u0439\u043b \u044d\u0442\u043e filesystem.py.<\/p>\n<h2>\u041f\u0438\u0448\u0435\u043c \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443<\/h2>\n<p>\u0412 \u044d\u0442\u043e\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 \u0431\u0443\u0434\u0443\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b \u043a\u043b\u0430\u0441\u0441\u044b \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0438 \u0442\u0430\u043a\u0436\u0435 \u0434\u0438\u0441\u043a\u0430.<\/p>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043d\u0443\u0436\u043d\u0443\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443:<\/p>\n<pre><code class=\"python\">try:   from dataclasses import * except:   #\u043d\u0438\u0436\u0435 3.7   raise SystemExit('\u0414\u0430\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043b\u0436\u0430 \u0431\u044b\u0442\u044c 3.7 \u0438 \u0432\u044b\u0448\u0435')<\/code><\/pre>\n<p>\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0434\u043b\u044f \u0434\u0430\u0442\u0430\u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438 \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0442\u043e \u044d\u0442\u043e python \u0432\u0435\u0440\u0441\u0438\u0438 3.6 \u0438 \u043d\u0438\u0436\u0435. \u0422\u0430\u043a \u0447\u0442\u043e \u0432\u044b\u0445\u043e\u0434\u0438\u043c \u0441 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c \u043e \u0432\u0435\u0440\u0441\u0438\u0438.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u043e\u0448\u0438\u0431\u043a\u0438:<\/p>\n<pre><code class=\"python\">class FSerror(Exception):   pass<\/code><\/pre>\n<p>\u0421\u043b\u0438\u0448\u043a\u043e\u043c \u043b\u0435\u0433\u043a\u043e \u0447\u0442\u043e\u0431\u044b \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"python\">#\u0442\u0443\u0442 \u0441\u0430\u043c\u0438 \u0444\u0430\u0439\u043b\u044b files = {}  @dataclass class File:   '''   \u041a\u043b\u0430\u0441\u0441 \u0444\u0430\u0439\u043b\u0430   name (str): \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430   text (any): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430   '''   name: str   text: str    def save(self):     files[self.name] = self.text<\/code><\/pre>\n<p>any &#8212; \u044d\u0442\u043e \u043b\u044e\u0431\u043e\u0439 \u0442\u0438\u043f<\/p>\n<p>save &#8212; \u043c\u0435\u0442\u043e\u0434 \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b<\/p>\n<p>name &#8212; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0438\u043c\u0435\u043d\u0438<\/p>\n<p>text &#8212; \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0433\u0434\u0435 \u0442\u0435\u043a\u0441\u0442<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441 \u0434\u043b\u044f \u0434\u0438\u0441\u043a\u0430:<\/p>\n<pre><code class=\"python\">class Disk:   '''   \u041a\u043b\u0430\u0441\u0441 \u0434\u0438\u0441\u043a\u0430   name (str): \u0438\u043c\u044f \u0434\u0438\u0441\u043a\u0430   '''   def __init__(self, name):     self.name = name     self.children = []    def add(self, file):     if file in files:       self.children.append(file)     else:       raise FSerror(f'\u0424\u0430\u0439\u043b \"{file}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')    def get(self, name):     if name in self.children:       return files[name]     raise FSerror(f'\u0424\u0430\u0439\u043b \"{name}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')    def delete(self, name):     if name in self.children:       del files[name]     raise FSerror(f'\u0424\u0430\u0439\u043b \"{name}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')  c = Disk('C:')<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u044c \u043e\u0434\u0438\u043d \u0434\u0438\u0441\u043a. \u0418 \u044d\u0442\u043e \u0434\u0438\u0441\u043a &#171;C&#187;<\/p>\n<p>add &#8212; \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0432 \u0434\u0438\u0441\u043a<\/p>\n<p>get &#8212; \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0432 \u0434\u0438\u0441\u043a\u0435<\/p>\n<p>delete &#8212; \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0444\u0430\u0439\u043b<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0431\u044a\u044f\u0432\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <code>__all__<\/code> (\u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u044b\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0439):<\/p>\n<pre><code class=\"python\">__all__ = ['File', 'files', 'c']<\/code><\/pre>\n<h2>\u0412\u0435\u0441\u044c \u043a\u043e\u0434.<\/h2>\n<pre><code class=\"python\">try:   from dataclasses import * except:   #\u043d\u0438\u0436\u0435 3.7   raise SystemExit('\u0414\u0430\u043d\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f \u0434\u043e\u043b\u0436\u0430 \u0431\u044b\u0442\u044c 3.7 \u0438 \u0432\u044b\u0448\u0435')  class FSerror(Exception):   pass  #\u0442\u0443\u0442 \u0441\u0430\u043c\u0438 \u0444\u0430\u0439\u043b\u044b files = {}  @dataclass class File:   '''   \u041a\u043b\u0430\u0441\u0441 \u0444\u0430\u0439\u043b\u0430   name (str): \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430   text (str): \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0444\u0430\u0439\u043b\u0430   '''   name: str   text: str    def save(self):       files[self.name] = self.text  class Disk:   '''   \u041a\u043b\u0430\u0441\u0441 \u0434\u0438\u0441\u043a\u0430   name (str): \u0438\u043c\u044f \u0434\u0438\u0441\u043a\u0430   '''   def __init__(self, name):     self.name = name     self.children = []    def add(self, file):     if file in files:       self.children.append(file)     else:       raise FSerror(f'\u0424\u0430\u0439\u043b \"{file}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')    def get(self, name):     if name in self.children:       return files[name]     raise FSerror(f'\u0424\u0430\u0439\u043b \"{name}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')    def delete(self, name):     if name in self.children:       del files[name]     raise FSerror(f'\u0424\u0430\u0439\u043b \"{name}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d')  c = Disk('C:')  __all__ = ['File', 'files', 'c']<\/code><\/pre>\n<p>\u0412\u0441\u0435\u0433\u043e 53 \u0441\u0442\u0440\u043e\u0447\u0435\u043a \u043a\u043e\u0434\u0430. \u041e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e \u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442.<\/p>\n<h2>\u0418\u0442\u043e\u0433 \u044d\u0442\u043e\u0439 \u0447\u0430\u0441\u0442\u0438.<\/h2>\n<p>\u041c\u044b \u0441\u0434\u0435\u043b\u0430\u043b\u0438 \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0434\u043b\u044f \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u0412\u043e\u0442 \u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:<\/p>\n<pre><code class=\"python\">#\u0432 PyShell &gt;&gt;&gt; hello = File('hello', '123') &gt;&gt;&gt; hello.save() &gt;&gt;&gt; c.add('hello') &gt;&gt;&gt; print(c.get('hello')) 123 &gt;&gt;&gt; c.delete('hello') &gt;&gt;&gt; print(c.get('hello')) Traceback (most recent call last):   File \"&lt;pyshell#2&gt;\", line 1, in &lt;module&gt;     print(c.get('hello'))   File \"C:\\Users\\DRA\\Desktop\\owner.py\", line 44, in get     raise FSerror(f'\u0424\u0430\u0439\u043b \"{name}\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d') FSerror: \u0424\u0430\u0439\u043b \"hello\" \u043d\u0435 \u043d\u0430\u0439\u0434\u0435\u043d &gt;&gt;&gt; <\/code><\/pre>\n<p>\u0413\u043e\u0442\u043e\u0432\u043e. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442.<\/p>\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\/901814\/\"> https:\/\/habr.com\/ru\/articles\/901814\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-456422","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/456422","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=456422"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/456422\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=456422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=456422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=456422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}