# German translation of the Python documentation. # Copyright (C) 2001 Python Software Foundation # This file is distributed under the same license as the Python package. # # Translators: # Swen Bachmann, 2026 # msgid "" msgstr "" "Project-Id-Version: Python 3.15\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2026-11-05 06:38+0000\n" "PO-Revision-Date: 2025-09-16 00:00+0000\n" "Last-Translator: Swen Bachmann\n" "Language-Team: German (https://github.com/python/python-docs-de)\n" "Language: de\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: ../../library/cmd.rst:2 msgid ":mod:`!cmd` --- Support for line-oriented command interpreters" msgstr ":mod:`!cmd` --- Unterstützung für zeilenorientierte Befehlsinterpreter" #: ../../library/cmd.rst:7 msgid "**Source code:** :source:`Lib/cmd.py`" msgstr "**Quellcode:** :source:`Lib/cmd.py`" #: ../../library/cmd.rst:11 msgid "" "The :class:`Cmd` class provides a simple framework for writing line-oriented " "command interpreters. These are often useful for test harnesses, " "administrative tools, and prototypes that will later be wrapped in a more " "sophisticated interface." msgstr "" "Die Klasse :class:`Cmd` bietet ein einfaches Framework zum Schreiben " "zeilenorientierter Befehlsinterpreter. Diese sind oft nützlich für " "Testumgebungen, Verwaltungswerkzeuge und Prototypen, die später in eine " "anspruchsvollere Oberfläche eingebettet werden." #: ../../library/cmd.rst:16 msgid "" "A command interpreter built with :class:`Cmd` typically presents the user " "with an interactive prompt, reads input one line at a time, and dispatches " "each command to a method named ``do_`` followed by the command name. For " "example, the ``help`` command is handled by the :meth:`~Cmd.do_help` " "method. Apart from the built-in ``help`` command, most of the interpreter's " "behavior is defined by the ``do_*`` methods you add in your own subclass." msgstr "" "Ein mit :class:`Cmd` gebauter Befehlsinterpreter zeigt dem Benutzer " "üblicherweise eine interaktive Eingabeaufforderung, liest die Eingabe " "zeilenweise und leitet jeden Befehl an eine Methode weiter, die ``do_`` " "gefolgt vom Befehlsnamen heißt. Der Befehl ``help`` wird zum Beispiel von " "der Methode :meth:`~Cmd.do_help` behandelt. Abgesehen vom eingebauten Befehl " "``help`` wird das Verhalten des Interpreters größtenteils durch die ``do_*``-" "Methoden bestimmt, die du in deiner eigenen Unterklasse hinzufügst." #: ../../library/cmd.rst:25 msgid "" "A :class:`Cmd` instance or subclass instance is a line-oriented interpreter " "framework. There is no good reason to instantiate :class:`Cmd` itself; " "rather, it's useful as a superclass of an interpreter class you define " "yourself in order to inherit :class:`Cmd`'s methods and encapsulate action " "methods." msgstr "" "Eine :class:`Cmd`-Instanz oder die Instanz einer Unterklasse ist ein " "Framework für zeilenorientierte Interpreter. Es gibt keinen guten " "Grund, :class:`Cmd` selbst zu instanziieren. Vielmehr ist die Klasse als " "Oberklasse einer selbst definierten Interpreterklasse nützlich, um die " "Methoden von :class:`Cmd` zu erben und Aktionsmethoden zu kapseln." #: ../../library/cmd.rst:30 msgid "" "The optional argument *completekey* is the :mod:`readline` name of a " "completion key; it defaults to :kbd:`Tab`. If *completekey* is " "not :const:`None` and :mod:`readline` is available, command completion is " "done automatically." msgstr "" "Das optionale Argument *completekey* ist der :mod:`readline`-Name einer " "Vervollständigungstaste. Standardmäßig ist es :kbd:`Tab`. Wenn *completekey* " "nicht :const:`None` ist und :mod:`readline` verfügbar ist, wird die " "Befehlsvervollständigung automatisch durchgeführt." #: ../../library/cmd.rst:34 msgid "" "The default, ``'tab'``, is treated specially, so that it refers to " "the :kbd:`Tab` key on every :data:`readline.backend`. Specifically, " "if :data:`readline.backend` is ``editline``, ``Cmd`` will use ``'^I'`` " "instead of ``'tab'``. Note that other values are not treated this way, and " "might only work with a specific backend." msgstr "" "Der Standardwert ``'tab'`` wird besonders behandelt: Er bezieht sich bei " "jedem :data:`readline.backend` auf die Taste :kbd:`Tab`. " "Ist :data:`readline.backend` insbesondere ``editline``, verwendet ``Cmd`` " "``'^I'`` statt ``'tab'``. Beachte, dass andere Werte nicht auf diese Weise " "behandelt werden und möglicherweise nur mit einem bestimmten Backend " "funktionieren." #: ../../library/cmd.rst:41 msgid "" "The optional arguments *stdin* and *stdout* specify the input and output " "file objects that the Cmd instance or subclass instance will use for input " "and output. If not specified, they will default to :data:`sys.stdin` " "and :data:`sys.stdout`." msgstr "" "Die optionalen Argumente *stdin* und *stdout* geben die Eingabe- und Ausgabe-" "Dateiobjekte an, die die Cmd-Instanz oder die Instanz der Unterklasse für " "Ein- und Ausgabe verwendet. Wenn sie nicht angegeben werden, sind sie " "standardmäßig :data:`sys.stdin` und :data:`sys.stdout`." #: ../../library/cmd.rst:46 msgid "" "If you want a given *stdin* to be used, make sure to set the " "instance's :attr:`use_rawinput` attribute to ``False``, otherwise *stdin* " "will be ignored." msgstr "" "Wenn ein bestimmtes *stdin* verwendet werden soll, setze das " "Attribut :attr:`use_rawinput` der Instanz auf ``False``, andernfalls wird " "*stdin* ignoriert." #: ../../library/cmd.rst:50 msgid "``completekey='tab'`` is replaced by ``'^I'`` for ``editline``." msgstr "``completekey='tab'`` wird für ``editline`` durch ``'^I'`` ersetzt." #: ../../library/cmd.rst:57 msgid "Cmd Objects" msgstr "Cmd-Objekte" #: ../../library/cmd.rst:59 msgid "A :class:`Cmd` instance has the following methods:" msgstr "Eine :class:`Cmd`-Instanz hat die folgenden Methoden:" #: ../../library/cmd.rst:64 msgid "" "Repeatedly issue a prompt, accept input, parse an initial prefix off the " "received input, and dispatch to action methods, passing them the remainder " "of the line as argument." msgstr "" "Gibt wiederholt eine Eingabeaufforderung aus, nimmt Eingaben entgegen, " "trennt ein einleitendes Präfix von der empfangenen Eingabe ab und leitet an " "Aktionsmethoden weiter, denen der Rest der Zeile als Argument übergeben wird." #: ../../library/cmd.rst:68 msgid "" "The optional argument is a banner or intro string to be issued before the " "first prompt (this overrides the :attr:`intro` class attribute)." msgstr "" "Das optionale Argument ist ein Banner oder Einleitungstext, der vor der " "ersten Eingabeaufforderung ausgegeben wird (dies überschreibt das " "Klassenattribut :attr:`intro`)." #: ../../library/cmd.rst:71 msgid "" "If the :mod:`readline` module is loaded, input will automatically " "inherit :program:`bash`\\ -like history-list editing (e.g. :kbd:`Control-P` " "scrolls back to the last command, :kbd:`Control-N` forward to the next " "one, :kbd:`Control-F` moves the cursor to the right non-" "destructively, :kbd:`Control-B` moves the cursor to the left non-" "destructively, etc.)." msgstr "" "Wenn das Modul :mod:`readline` geladen ist, übernimmt die Eingabe " "automatisch die :program:`bash`\\ -ähnliche Bearbeitung der Verlaufsliste " "(z. B. blättert :kbd:`Control-P` zum letzten Befehl zurück, :kbd:`Control-N` " "vor zum nächsten, :kbd:`Control-F` bewegt den Cursor nicht zerstörend nach " "rechts, :kbd:`Control-B` bewegt den Cursor nicht zerstörend nach links usw.)." #: ../../library/cmd.rst:77 msgid "An end-of-file on input is passed back as the string ``'EOF'``." msgstr "" "Ein Dateiende bei der Eingabe wird als der String ``'EOF'`` zurückgegeben." #: ../../library/cmd.rst:83 msgid "" "An interpreter instance will recognize a command name ``foo`` if and only if " "it has a method :meth:`!do_foo`. As a special case, a line beginning with " "the character ``'?'`` is dispatched to the method :meth:`do_help`. As " "another special case, a line beginning with the character ``'!'`` is " "dispatched to the method :meth:`!do_shell` (if such a method is defined)." msgstr "" "Eine Interpreter-Instanz erkennt einen Befehlsnamen ``foo`` genau dann, wenn " "sie eine Methode :meth:`!do_foo` hat. Als Sonderfall wird eine Zeile, die " "mit dem Zeichen ``'?'`` beginnt, an die Methode :meth:`do_help` " "weitergeleitet. Als weiterer Sonderfall wird eine Zeile, die mit dem Zeichen " "``'!'`` beginnt, an die Methode :meth:`!do_shell` weitergeleitet (falls eine " "solche Methode definiert ist)." #: ../../library/cmd.rst:89 msgid "" "This method will return when the :meth:`postcmd` method returns a true " "value. The *stop* argument to :meth:`postcmd` is the return value from the " "command's corresponding :meth:`!do_\\*` method." msgstr "" "Diese Methode kehrt zurück, wenn die Methode :meth:`postcmd` einen wahren " "Wert zurückgibt. Das Argument *stop* von :meth:`postcmd` ist der " "Rückgabewert der entsprechenden Methode :meth:`!do_\\*` des Befehls." #: ../../library/cmd.rst:93 msgid "" "If completion is enabled, completing commands will be done automatically, " "and completing of commands args is done by calling :meth:`!complete_foo` " "with arguments *text*, *line*, *begidx*, and *endidx*. *text* is the string " "prefix we are attempting to match: all returned matches must begin with it. " "*line* is the current input line with leading whitespace removed, *begidx* " "and *endidx* are the beginning and ending indexes of the prefix text, which " "could be used to provide different completion depending upon which position " "the argument is in." msgstr "" "Wenn die Vervollständigung aktiviert ist, werden Befehle automatisch " "vervollständigt, und die Vervollständigung von Befehlsargumenten erfolgt " "durch Aufruf von :meth:`!complete_foo` mit den Argumenten *text*, *line*, " "*begidx* und *endidx*. *text* ist das String-Präfix, das wir zu finden " "versuchen: Alle zurückgegebenen Treffer müssen damit beginnen. *line* ist " "die aktuelle Eingabezeile ohne führende Leerzeichen, *begidx* und *endidx* " "sind der Anfangs- und der Endindex des Präfixtexts, die sich verwenden " "lassen, um je nach Position des Arguments unterschiedliche " "Vervollständigungen anzubieten." #: ../../library/cmd.rst:104 msgid "" "All subclasses of :class:`Cmd` inherit a predefined :meth:`!do_help`. This " "method, called with an argument ``'bar'``, invokes the corresponding " "method :meth:`!help_bar`, and if that is not present, prints the docstring " "of :meth:`!do_bar`, if available. With no argument, :meth:`!do_help` lists " "all available help topics (that is, all commands with corresponding :meth:`!" "help_\\*` methods or commands that have docstrings), and also lists any " "undocumented commands." msgstr "" "Alle Unterklassen von :class:`Cmd` erben eine vordefinierte Methode :meth:`!" "do_help`. Wird sie mit dem Argument ``'bar'`` aufgerufen, ruft sie die " "entsprechende Methode :meth:`!help_bar` auf und gibt, falls diese nicht " "vorhanden ist, den Docstring von :meth:`!do_bar` aus, sofern verfügbar. Ohne " "Argument listet :meth:`!do_help` alle verfügbaren Hilfethemen auf (das heißt " "alle Befehle mit entsprechenden :meth:`!help_\\*`-Methoden oder Befehle, die " "Docstrings haben) und außerdem alle undokumentierten Befehle." #: ../../library/cmd.rst:115 msgid "" "Interpret the argument as though it had been typed in response to the " "prompt. This may be overridden, but should not normally need to be; see " "the :meth:`precmd` and :meth:`postcmd` methods for useful execution hooks. " "The return value is a flag indicating whether interpretation of commands by " "the interpreter should stop. If there is a :meth:`!do_\\*` method for the " "command *line*, the return value of that method is returned, otherwise the " "return value from the :meth:`default` method is returned." msgstr "" "Interpretiert das Argument so, als wäre es als Antwort auf die " "Eingabeaufforderung eingegeben worden. Die Methode kann überschrieben " "werden, muss es normalerweise aber nicht. Nützliche Hooks für die Ausführung " "bieten die Methoden :meth:`precmd` und :meth:`postcmd`. Der Rückgabewert ist " "ein Flag, das angibt, ob die Interpretation von Befehlen durch den " "Interpreter beendet werden soll. Gibt es eine Methode :meth:`!do_\\*` für " "den Befehl *line*, wird deren Rückgabewert zurückgegeben, andernfalls der " "Rückgabewert der Methode :meth:`default`." #: ../../library/cmd.rst:126 msgid "" "Method called when an empty line is entered in response to the prompt. If " "this method is not overridden, it repeats the last nonempty command entered." msgstr "" "Methode, die aufgerufen wird, wenn als Antwort auf die Eingabeaufforderung " "eine leere Zeile eingegeben wird. Wird diese Methode nicht überschrieben, " "wiederholt sie den zuletzt eingegebenen nicht leeren Befehl." #: ../../library/cmd.rst:132 msgid "" "Method called on an input line when the command prefix is not recognized. If " "this method is not overridden, it prints an error message and returns." msgstr "" "Methode, die bei einer Eingabezeile aufgerufen wird, wenn das Befehlspräfix " "nicht erkannt wird. Wird diese Methode nicht überschrieben, gibt sie eine " "Fehlermeldung aus und kehrt zurück." #: ../../library/cmd.rst:138 msgid "" "Method called to complete an input line when no command-specific :meth:`!" "complete_\\*` method is available. By default, it returns an empty list." msgstr "" "Methode, die aufgerufen wird, um eine Eingabezeile zu vervollständigen, wenn " "keine befehlsspezifische Methode :meth:`!complete_\\*` verfügbar ist. " "Standardmäßig gibt sie eine leere Liste zurück." #: ../../library/cmd.rst:144 msgid "" "Method called to display a list of strings as a compact set of columns. Each " "column is only as wide as necessary. Columns are separated by two spaces for " "readability." msgstr "" "Methode, die aufgerufen wird, um eine Liste von Strings als kompakte Spalten " "anzuzeigen. Jede Spalte ist nur so breit wie nötig. Zur besseren Lesbarkeit " "sind die Spalten durch zwei Leerzeichen getrennt." #: ../../library/cmd.rst:151 msgid "" "Hook method executed just before the command line *line* is interpreted, but " "after the input prompt is generated and issued. This method is a stub " "in :class:`Cmd`; it exists to be overridden by subclasses. The return value " "is used as the command which will be executed by the :meth:`onecmd` method; " "the :meth:`precmd` implementation may re-write the command or simply return " "*line* unchanged." msgstr "" "Hook-Methode, die unmittelbar vor der Interpretation der Befehlszeile *line* " "ausgeführt wird, aber nachdem die Eingabeaufforderung erzeugt und ausgegeben " "wurde. Diese Methode ist in :class:`Cmd` nur ein Platzhalter und existiert, " "um von Unterklassen überschrieben zu werden. Der Rückgabewert wird als " "Befehl verwendet, den die Methode :meth:`onecmd` ausführt. Die " "Implementierung von :meth:`precmd` darf den Befehl umschreiben oder einfach " "*line* unverändert zurückgeben." #: ../../library/cmd.rst:161 msgid "" "Hook method executed just after a command dispatch is finished. This method " "is a stub in :class:`Cmd`; it exists to be overridden by subclasses. *line* " "is the command line which was executed, and *stop* is a flag which indicates " "whether execution will be terminated after the call to :meth:`postcmd`; this " "will be the return value of the :meth:`onecmd` method. The return value of " "this method will be used as the new value for the internal flag which " "corresponds to *stop*; returning false will cause interpretation to continue." msgstr "" "Hook-Methode, die unmittelbar nach Abschluss der Befehlsweiterleitung " "ausgeführt wird. Diese Methode ist in :class:`Cmd` nur ein Platzhalter und " "existiert, um von Unterklassen überschrieben zu werden. *line* ist die " "ausgeführte Befehlszeile, und *stop* ist ein Flag, das angibt, ob die " "Ausführung nach dem Aufruf von :meth:`postcmd` beendet wird. Das ist der " "Rückgabewert der Methode :meth:`onecmd`. Der Rückgabewert dieser Methode " "wird als neuer Wert für das interne Flag verwendet, das *stop* entspricht. " "Gibt sie einen falschen Wert zurück, wird die Interpretation fortgesetzt." #: ../../library/cmd.rst:172 msgid "" "Hook method executed once when :meth:`cmdloop` is called. This method is a " "stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" "Hook-Methode, die einmalig beim Aufruf von :meth:`cmdloop` ausgeführt wird. " "Diese Methode ist in :class:`Cmd` nur ein Platzhalter und existiert, um von " "Unterklassen überschrieben zu werden." #: ../../library/cmd.rst:178 msgid "" "Hook method executed once when :meth:`cmdloop` is about to return. This " "method is a stub in :class:`Cmd`; it exists to be overridden by subclasses." msgstr "" "Hook-Methode, die einmalig ausgeführt wird, kurz bevor :meth:`cmdloop` " "zurückkehrt. Diese Methode ist in :class:`Cmd` nur ein Platzhalter und " "existiert, um von Unterklassen überschrieben zu werden." #: ../../library/cmd.rst:182 msgid "" "Instances of :class:`Cmd` subclasses have some public instance variables:" msgstr "" "Instanzen von Unterklassen von :class:`Cmd` haben einige öffentliche " "Instanzvariablen:" #: ../../library/cmd.rst:186 msgid "The prompt issued to solicit input." msgstr "Die Eingabeaufforderung, die zur Eingabe auffordert." #: ../../library/cmd.rst:191 msgid "The string of characters accepted for the command prefix." msgstr "Der String aus Zeichen, die als Befehlspräfix akzeptiert werden." #: ../../library/cmd.rst:196 msgid "The last nonempty command prefix seen." msgstr "Das zuletzt gesehene nicht leere Befehlspräfix." #: ../../library/cmd.rst:201 msgid "" "A list of queued input lines. The cmdqueue list is checked " "in :meth:`cmdloop` when new input is needed; if it is nonempty, its elements " "will be processed in order, as if entered at the prompt." msgstr "" "Eine Liste von Eingabezeilen in der Warteschlange. Die Liste cmdqueue wird " "in :meth:`cmdloop` geprüft, wenn neue Eingabe benötigt wird. Ist sie nicht " "leer, werden ihre Elemente der Reihe nach verarbeitet, als wären sie an der " "Eingabeaufforderung eingegeben worden." #: ../../library/cmd.rst:208 msgid "" "A string to issue as an intro or banner. May be overridden by giving " "the :meth:`cmdloop` method an argument." msgstr "" "Ein String, der als Einleitung oder Banner ausgegeben wird. Er kann " "überschrieben werden, indem der Methode :meth:`cmdloop` ein Argument " "übergeben wird." #: ../../library/cmd.rst:214 msgid "" "The header to issue if the help output has a section for documented commands." msgstr "" "Die Überschrift, die ausgegeben wird, wenn die Hilfeausgabe einen Abschnitt " "für dokumentierte Befehle hat." #: ../../library/cmd.rst:219 msgid "" "The header to issue if the help output has a section for miscellaneous help " "topics (that is, there are :meth:`!help_\\*` methods without " "corresponding :meth:`!do_\\*` methods)." msgstr "" "Die Überschrift, die ausgegeben wird, wenn die Hilfeausgabe einen Abschnitt " "für sonstige Hilfethemen hat (das heißt, es gibt :meth:`!help_\\*`-Methoden " "ohne entsprechende :meth:`!do_\\*`-Methoden)." #: ../../library/cmd.rst:226 msgid "" "The header to issue if the help output has a section for undocumented " "commands (that is, there are :meth:`!do_\\*` methods without " "corresponding :meth:`!help_\\*` methods)." msgstr "" "Die Überschrift, die ausgegeben wird, wenn die Hilfeausgabe einen Abschnitt " "für undokumentierte Befehle hat (das heißt, es gibt :meth:`!do_\\*`-Methoden " "ohne entsprechende :meth:`!help_\\*`-Methoden)." #: ../../library/cmd.rst:233 msgid "" "The character used to draw separator lines under the help-message headers. " "If empty, no ruler line is drawn. It defaults to ``'='``." msgstr "" "Das Zeichen, mit dem Trennlinien unter den Überschriften der Hilfemeldungen " "gezeichnet werden. Ist es leer, wird keine Trennlinie gezeichnet. " "Standardmäßig ist es ``'='``." #: ../../library/cmd.rst:239 msgid "" "A flag, defaulting to true. If true, :meth:`cmdloop` uses :func:`input` to " "display a prompt and read the next command; if " "false, :data:`sys.stdout.write() ` " "and :data:`sys.stdin.readline() ` are used. (This means that by " "importing :mod:`readline`, on systems that support it, the interpreter will " "automatically support :program:`Emacs`\\ -like line editing and command-" "history keystrokes.)" msgstr "" "Ein Flag, standardmäßig wahr. Ist es wahr, " "verwendet :meth:`cmdloop` :func:`input`, um eine Eingabeaufforderung " "anzuzeigen und den nächsten Befehl zu lesen. Ist es falsch, " "werden :data:`sys.stdout.write() ` " "und :data:`sys.stdin.readline() ` verwendet. (Das bedeutet, dass " "der Interpreter auf Systemen, die es unterstützen, durch den Import " "von :mod:`readline` automatisch :program:`Emacs`\\ -ähnliche " "Zeilenbearbeitung und Tastenkürzel für den Befehlsverlauf unterstützt.)" #: ../../library/cmd.rst:249 msgid "Cmd Example" msgstr "Cmd-Beispiel" #: ../../library/cmd.rst:251 msgid "" "The :mod:`!cmd` module is mainly useful for building custom shells that let " "a user work with a program interactively." msgstr "" "Das Modul :mod:`!cmd` ist vor allem nützlich, um eigene Shells zu bauen, mit " "denen ein Benutzer interaktiv mit einem Programm arbeiten kann." #: ../../library/cmd.rst:254 msgid "" "This section presents a simple example of how to build a shell around a few " "of the commands in the :mod:`turtle` module." msgstr "" "Dieser Abschnitt zeigt ein einfaches Beispiel, wie man eine Shell um einige " "der Befehle des Moduls :mod:`turtle` baut." #: ../../library/cmd.rst:257 msgid "" "Basic turtle commands such as :meth:`~turtle.forward` are added to " "a :class:`Cmd` subclass with method named :meth:`!do_forward`. The argument " "is converted to a number and dispatched to the turtle module. The docstring " "is used in the help utility provided by the shell." msgstr "" "Grundlegende Turtle-Befehle wie :meth:`~turtle.forward` werden einer " "Unterklasse von :class:`Cmd` mit einer Methode namens :meth:`!do_forward` " "hinzugefügt. Das Argument wird in eine Zahl umgewandelt und an das Modul " "turtle weitergeleitet. Der Docstring wird in der von der Shell " "bereitgestellten Hilfefunktion verwendet." #: ../../library/cmd.rst:262 msgid "" "The example also includes a basic record and playback facility implemented " "with the :meth:`~Cmd.precmd` method which is responsible for converting the " "input to lowercase and writing the commands to a file. The :meth:`!" "do_playback` method reads the file and adds the recorded commands to " "the :attr:`~Cmd.cmdqueue` for immediate playback::" msgstr "" "Das Beispiel enthält außerdem eine einfache Aufzeichnungs- und " "Wiedergabefunktion, die mit der Methode :meth:`~Cmd.precmd` umgesetzt ist. " "Diese wandelt die Eingabe in Kleinbuchstaben um und schreibt die Befehle in " "eine Datei. Die Methode :meth:`!do_playback` liest die Datei und fügt die " "aufgezeichneten Befehle zur sofortigen Wiedergabe zu :attr:`~Cmd.cmdqueue` " "hinzu::" #: ../../library/cmd.rst:268 msgid "" "import cmd, sys\n" "from turtle import *\n" "\n" "class TurtleShell(cmd.Cmd):\n" " intro = 'Welcome to the turtle shell. Type help or ? to list commands." "\\n'\n" " prompt = '(turtle) '\n" " file = None\n" "\n" " # ----- basic turtle commands -----\n" " def do_forward(self, arg):\n" " 'Move the turtle forward by the specified distance: FORWARD 10'\n" " forward(*parse(arg))\n" " def do_right(self, arg):\n" " 'Turn turtle right by given number of degrees: RIGHT 20'\n" " right(*parse(arg))\n" " def do_left(self, arg):\n" " 'Turn turtle left by given number of degrees: LEFT 90'\n" " left(*parse(arg))\n" " def do_goto(self, arg):\n" " 'Move turtle to an absolute position with changing orientation. " "GOTO 100 200'\n" " goto(*parse(arg))\n" " def do_home(self, arg):\n" " 'Return turtle to the home position: HOME'\n" " home()\n" " def do_circle(self, arg):\n" " 'Draw circle with given radius an options extent and steps: CIRCLE " "50'\n" " circle(*parse(arg))\n" " def do_position(self, arg):\n" " 'Print the current turtle position: POSITION'\n" " print('Current position is %d %d\\n' % position())\n" " def do_heading(self, arg):\n" " 'Print the current turtle heading in degrees: HEADING'\n" " print('Current heading is %d\\n' % (heading(),))\n" " def do_color(self, arg):\n" " 'Set the color: COLOR BLUE'\n" " color(arg.lower())\n" " def do_undo(self, arg):\n" " 'Undo (repeatedly) the last turtle action(s): UNDO'\n" " def do_reset(self, arg):\n" " 'Clear the screen and return turtle to center: RESET'\n" " reset()\n" " def do_bye(self, arg):\n" " 'Stop recording, close the turtle window, and exit: BYE'\n" " print('Thank you for using Turtle')\n" " self.close()\n" " bye()\n" " return True\n" "\n" " # ----- record and playback -----\n" " def do_record(self, arg):\n" " 'Save future commands to filename: RECORD rose.cmd'\n" " self.file = open(arg, 'w')\n" " def do_playback(self, arg):\n" " 'Playback commands from a file: PLAYBACK rose.cmd'\n" " self.close()\n" " with open(arg) as f:\n" " self.cmdqueue.extend(f.read().splitlines())\n" " def precmd(self, line):\n" " line = line.lower()\n" " if self.file and 'playback' not in line:\n" " print(line, file=self.file)\n" " return line\n" " def close(self):\n" " if self.file:\n" " self.file.close()\n" " self.file = None\n" "\n" "def parse(arg):\n" " 'Convert a series of zero or more numbers to an argument tuple'\n" " return tuple(map(int, arg.split()))\n" "\n" "if __name__ == '__main__':\n" " TurtleShell().cmdloop()" msgstr "" "import cmd, sys\n" "from turtle import *\n" "\n" "class TurtleShell(cmd.Cmd):\n" " intro = 'Welcome to the turtle shell. Type help or ? to list commands." "\\n'\n" " prompt = '(turtle) '\n" " file = None\n" "\n" " # ----- basic turtle commands -----\n" " def do_forward(self, arg):\n" " 'Move the turtle forward by the specified distance: FORWARD 10'\n" " forward(*parse(arg))\n" " def do_right(self, arg):\n" " 'Turn turtle right by given number of degrees: RIGHT 20'\n" " right(*parse(arg))\n" " def do_left(self, arg):\n" " 'Turn turtle left by given number of degrees: LEFT 90'\n" " left(*parse(arg))\n" " def do_goto(self, arg):\n" " 'Move turtle to an absolute position with changing orientation. " "GOTO 100 200'\n" " goto(*parse(arg))\n" " def do_home(self, arg):\n" " 'Return turtle to the home position: HOME'\n" " home()\n" " def do_circle(self, arg):\n" " 'Draw circle with given radius an options extent and steps: CIRCLE " "50'\n" " circle(*parse(arg))\n" " def do_position(self, arg):\n" " 'Print the current turtle position: POSITION'\n" " print('Current position is %d %d\\n' % position())\n" " def do_heading(self, arg):\n" " 'Print the current turtle heading in degrees: HEADING'\n" " print('Current heading is %d\\n' % (heading(),))\n" " def do_color(self, arg):\n" " 'Set the color: COLOR BLUE'\n" " color(arg.lower())\n" " def do_undo(self, arg):\n" " 'Undo (repeatedly) the last turtle action(s): UNDO'\n" " def do_reset(self, arg):\n" " 'Clear the screen and return turtle to center: RESET'\n" " reset()\n" " def do_bye(self, arg):\n" " 'Stop recording, close the turtle window, and exit: BYE'\n" " print('Thank you for using Turtle')\n" " self.close()\n" " bye()\n" " return True\n" "\n" " # ----- record and playback -----\n" " def do_record(self, arg):\n" " 'Save future commands to filename: RECORD rose.cmd'\n" " self.file = open(arg, 'w')\n" " def do_playback(self, arg):\n" " 'Playback commands from a file: PLAYBACK rose.cmd'\n" " self.close()\n" " with open(arg) as f:\n" " self.cmdqueue.extend(f.read().splitlines())\n" " def precmd(self, line):\n" " line = line.lower()\n" " if self.file and 'playback' not in line:\n" " print(line, file=self.file)\n" " return line\n" " def close(self):\n" " if self.file:\n" " self.file.close()\n" " self.file = None\n" "\n" "def parse(arg):\n" " 'Convert a series of zero or more numbers to an argument tuple'\n" " return tuple(map(int, arg.split()))\n" "\n" "if __name__ == '__main__':\n" " TurtleShell().cmdloop()" #: ../../library/cmd.rst:343 msgid "" "Here is a sample session with the turtle shell showing the help functions, " "using blank lines to repeat commands, and the simple record and playback " "facility:" msgstr "" "Hier ist eine Beispielsitzung mit der Turtle-Shell. Sie zeigt die " "Hilfefunktionen, das Wiederholen von Befehlen mit Leerzeilen und die " "einfache Aufzeichnungs- und Wiedergabefunktion:" #: ../../library/cmd.rst:346 msgid "" "Welcome to the turtle shell. Type help or ? to list commands.\n" "\n" "(turtle) ?\n" "\n" "Documented commands (type help ):\n" "========================================\n" "bye color goto home playback record right\n" "circle forward heading left position reset undo\n" "\n" "(turtle) help forward\n" "Move the turtle forward by the specified distance: FORWARD 10\n" "(turtle) record spiral.cmd\n" "(turtle) position\n" "Current position is 0 0\n" "\n" "(turtle) heading\n" "Current heading is 0\n" "\n" "(turtle) reset\n" "(turtle) circle 20\n" "(turtle) right 30\n" "(turtle) circle 40\n" "(turtle) right 30\n" "(turtle) circle 60\n" "(turtle) right 30\n" "(turtle) circle 80\n" "(turtle) right 30\n" "(turtle) circle 100\n" "(turtle) right 30\n" "(turtle) circle 120\n" "(turtle) right 30\n" "(turtle) circle 120\n" "(turtle) heading\n" "Current heading is 180\n" "\n" "(turtle) forward 100\n" "(turtle)\n" "(turtle) right 90\n" "(turtle) forward 100\n" "(turtle)\n" "(turtle) right 90\n" "(turtle) forward 400\n" "(turtle) right 90\n" "(turtle) forward 500\n" "(turtle) right 90\n" "(turtle) forward 400\n" "(turtle) right 90\n" "(turtle) forward 300\n" "(turtle) playback spiral.cmd\n" "Current position is 0 0\n" "\n" "Current heading is 0\n" "\n" "Current heading is 180\n" "\n" "(turtle) bye\n" "Thank you for using Turtle" msgstr "" "Welcome to the turtle shell. Type help or ? to list commands.\n" "\n" "(turtle) ?\n" "\n" "Documented commands (type help ):\n" "========================================\n" "bye color goto home playback record right\n" "circle forward heading left position reset undo\n" "\n" "(turtle) help forward\n" "Move the turtle forward by the specified distance: FORWARD 10\n" "(turtle) record spiral.cmd\n" "(turtle) position\n" "Current position is 0 0\n" "\n" "(turtle) heading\n" "Current heading is 0\n" "\n" "(turtle) reset\n" "(turtle) circle 20\n" "(turtle) right 30\n" "(turtle) circle 40\n" "(turtle) right 30\n" "(turtle) circle 60\n" "(turtle) right 30\n" "(turtle) circle 80\n" "(turtle) right 30\n" "(turtle) circle 100\n" "(turtle) right 30\n" "(turtle) circle 120\n" "(turtle) right 30\n" "(turtle) circle 120\n" "(turtle) heading\n" "Current heading is 180\n" "\n" "(turtle) forward 100\n" "(turtle)\n" "(turtle) right 90\n" "(turtle) forward 100\n" "(turtle)\n" "(turtle) right 90\n" "(turtle) forward 400\n" "(turtle) right 90\n" "(turtle) forward 500\n" "(turtle) right 90\n" "(turtle) forward 400\n" "(turtle) right 90\n" "(turtle) forward 300\n" "(turtle) playback spiral.cmd\n" "Current position is 0 0\n" "\n" "Current heading is 0\n" "\n" "Current heading is 180\n" "\n" "(turtle) bye\n" "Thank you for using Turtle" #: ../../library/cmd.rst:79 msgid "? (question mark)" msgstr "? (Fragezeichen)" #: ../../library/cmd.rst:79 msgid "in a command interpreter" msgstr "in einem Befehlsinterpreter" #: ../../library/cmd.rst:79 msgid "! (exclamation)" msgstr "! (Ausrufezeichen)"