diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..829c571c8 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,38 @@ +name: deploy +on: + push: + branches: + - xin + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - uses: s-weigand/setup-conda@v1 + - run: conda --version + - run: which python + + - name: Install dependencies + run: | + pip install -r requirements.txt + pip install sphinx-intl + + - name: Build the book + run: | + sphinx-build -b gettext docs build/gettext + sphinx-intl update -p build/gettext -l zh_CN + sphinx-build -D language=zh_CN -b html docs build/html + + - name: GitHub Pages action + uses: peaceiris/actions-gh-pages@v3.6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: build/html + user_name: "github-actions[bot]" + user_email: "github-actions[bot]@users.noreply.github.com" \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index d732ac29f..6576d534d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -64,7 +64,7 @@ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +language = 'zh_CN' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -286,3 +286,6 @@ intersphinx_mapping = { 'python': ('https://docs.python.org/3', None), } + +locale_dirs = ['../locales'] +gettext_compact = False # optional. \ No newline at end of file diff --git a/locales/.gitignore b/locales/.gitignore new file mode 100644 index 000000000..c90071a51 --- /dev/null +++ b/locales/.gitignore @@ -0,0 +1 @@ +*.mo \ No newline at end of file diff --git a/locales/zh_CN/LC_MESSAGES/404.po b/locales/zh_CN/LC_MESSAGES/404.po new file mode 100644 index 000000000..9918e61fc --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/404.po @@ -0,0 +1,52 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-18 16:06+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../docs/404.rst:5 +msgid "404 — Not Found" +msgstr "" + +#: ../../docs/404.rst:7 +msgid "**Sorry, but we couldn't find the page you requested.**" +msgstr "" + +#: ../../docs/404.rst:9 +msgid "It looks like this was the result of either:" +msgstr "" + +#: ../../docs/404.rst:11 +msgid "a mistyped address" +msgstr "" + +#: ../../docs/404.rst:12 +msgid "an out-of-date link" +msgstr "" + +#: ../../docs/404.rst:14 +msgid "`Click here to go back to the homepage. `_" +msgstr "" + +#: ../../docs/404.rst:16 +msgid "Or, try `searching `_." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/dev/env.po b/locales/zh_CN/LC_MESSAGES/dev/env.po new file mode 100644 index 000000000..13d3e0ac1 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/dev/env.po @@ -0,0 +1,595 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../dev/env.rst:2 +msgid "Your Development Environment" +msgstr "" + +#: ../../dev/env.rst:8 +msgid "Text Editors" +msgstr "" + +#: ../../dev/env.rst:10 +msgid "" +"Just about anything that can edit plain text will work for writing Python" +" code; however, using a more powerful editor may make your life a bit " +"easier." +msgstr "" + +#: ../../dev/env.rst:15 +msgid "Vim" +msgstr "" + +#: ../../dev/env.rst:17 +msgid "" +"Vim is a text editor which uses keyboard shortcuts for editing instead of" +" menus or icons. There are a couple of plugins and settings for the Vim " +"editor to aid Python development. If you only develop in Python, a good " +"start is to set the default settings for indentation and line-wrapping to" +" values compliant with :pep:`8`. In your home directory, open a file " +"called :file:`.vimrc` and add the following lines::" +msgstr "" + +#: ../../dev/env.rst:32 +msgid "" +"With these settings, newlines are inserted after 79 characters and " +"indentation is set to 4 spaces per tab. If you also use Vim for other " +"languages, there is a handy plugin called indent_, which handles " +"indentation settings for Python source files." +msgstr "" + +#: ../../dev/env.rst:37 +msgid "" +"There is also a handy syntax plugin called syntax_ featuring some " +"improvements over the syntax file included in Vim 6.1." +msgstr "" + +#: ../../dev/env.rst:40 +msgid "" +"These plugins supply you with a basic environment for developing in " +"Python. To get the most out of Vim, you should continually check your " +"code for syntax errors and PEP8 compliance. Luckily pycodestyle_ and " +"Pyflakes_ will do this for you. If your Vim is compiled with ``+python`` " +"you can also utilize some very handy plugins to do these checks from " +"within the editor." +msgstr "" + +#: ../../dev/env.rst:46 +msgid "" +"For PEP8 checking and pyflakes, you can install vim-flake8_. Now you can " +"map the function ``Flake8`` to any hotkey or action you want in Vim. The " +"plugin will display errors at the bottom of the screen, and provide an " +"easy way to jump to the corresponding line. It's very handy to call this " +"function whenever you save a file. In order to do this, add the following" +" line to your :file:`.vimrc`::" +msgstr "" + +#: ../../dev/env.rst:55 +msgid "" +"If you are already using syntastic_, you can set it to run Pyflakes on " +"write and show errors and warnings in the quickfix window. An example " +"configuration to do that which also shows status and warning messages in " +"the statusbar would be::" +msgstr "" + +#: ../../dev/env.rst:68 +msgid "Python-mode" +msgstr "" + +#: ../../dev/env.rst:70 +msgid "" +"Python-mode_ is a complex solution for working with Python code in Vim. " +"It has:" +msgstr "" + +#: ../../dev/env.rst:73 +msgid "" +"Asynchronous Python code checking (``pylint``, ``pyflakes``, " +"``pycodestyle``, ``mccabe``) in any combination" +msgstr "" + +#: ../../dev/env.rst:74 +msgid "Code refactoring and autocompletion with Rope" +msgstr "" + +#: ../../dev/env.rst:75 +msgid "Fast Python folding" +msgstr "" + +#: ../../dev/env.rst:76 +msgid "Virtualenv support" +msgstr "" + +#: ../../dev/env.rst:77 +msgid "Search through Python documentation and run Python code" +msgstr "" + +#: ../../dev/env.rst:78 +msgid "Auto pycodestyle_ error fixes" +msgstr "" + +#: ../../dev/env.rst:80 +msgid "And more." +msgstr "" + +#: ../../dev/env.rst:83 +msgid "SuperTab" +msgstr "" + +#: ../../dev/env.rst:85 +msgid "" +"SuperTab_ is a small Vim plugin that makes code completion more " +"convenient by using ```` key or any other customized keys." +msgstr "" + +#: ../../dev/env.rst:98 +msgid "Emacs" +msgstr "" + +#: ../../dev/env.rst:100 +msgid "" +"Emacs is another powerful text editor. It is fully programmable (Lisp), " +"but it can be some work to wire up correctly. A good start if you're " +"already an Emacs user is `Python Programming in Emacs`_ at EmacsWiki." +msgstr "" + +#: ../../dev/env.rst:104 +msgid "Emacs itself comes with a Python mode." +msgstr "" + +#: ../../dev/env.rst:109 +msgid "TextMate" +msgstr "" + +#: ../../dev/env.rst:111 +msgid "" +"`TextMate `_ brings Apple's approach to operating" +" systems into the world of text editors. By bridging Unix underpinnings " +"and GUI, TextMate cherry-picks the best of both worlds to the benefit of " +"expert scripters and novice users alike." +msgstr "" + +#: ../../dev/env.rst:117 +msgid "Sublime Text" +msgstr "" + +#: ../../dev/env.rst:119 +msgid "" +"`Sublime Text `_ is a sophisticated text " +"editor for code, markup, and prose. You'll love the slick user interface," +" extraordinary features, and amazing performance." +msgstr "" + +#: ../../dev/env.rst:123 +msgid "" +"Sublime Text has excellent support for editing Python code and uses " +"Python for its plugin API. It also has a diverse variety of plugins, " +"`some of which `_ allow " +"for in-editor PEP8 checking and code \"linting\"." +msgstr "" + +#: ../../dev/env.rst:129 +msgid "Atom" +msgstr "" + +#: ../../dev/env.rst:131 +msgid "" +"`Atom `_ is a hackable text editor for the 21st " +"century, built on atom-shell, and based on everything we love about our " +"favorite editors." +msgstr "" + +#: ../../dev/env.rst:135 +msgid "" +"Atom is web native (HTML, CSS, JS), focusing on modular design and easy " +"plugin development. It comes with native package control and a plethora " +"of packages. Recommended for Python development is `Linter " +"`_ combined with `linter-flake8 " +"`_." +msgstr "" + +#: ../../dev/env.rst:142 +msgid "Python (on Visual Studio Code)" +msgstr "" + +#: ../../dev/env.rst:144 +msgid "" +"`Python for Visual Studio " +"`_ " +"is an extension for the `Visual Studio Code " +"`_. This is a free, lightweight, open " +"source code editor, with support for Mac, Windows, and Linux. Built using" +" open source technologies such as Node.js and Python, with compelling " +"features such as Intellisense (autocompletion), local and remote " +"debugging, linting, and the like." +msgstr "" + +#: ../../dev/env.rst:148 +msgid "MIT licensed." +msgstr "" + +#: ../../dev/env.rst:151 +msgid "IDEs" +msgstr "" + +#: ../../dev/env.rst:154 +msgid "PyCharm / IntelliJ IDEA" +msgstr "" + +#: ../../dev/env.rst:156 +msgid "" +"`PyCharm `_ is developed by JetBrains," +" also known for IntelliJ IDEA. Both share the same code base and most of " +"PyCharm's features can be brought to IntelliJ with the free `Python Plug-" +"In `_. There " +"are two versions of PyCharm: Professional Edition (Free 30-day trial) and" +" Community Edition (Apache 2.0 License) with fewer features." +msgstr "" + +#: ../../dev/env.rst:165 +msgid "Enthought Canopy" +msgstr "" + +#: ../../dev/env.rst:166 +msgid "" +"`Enthought Canopy `_ is a " +"Python IDE which is focused towards Scientists and Engineers as it " +"provides pre installed libraries for data analysis." +msgstr "" + +#: ../../dev/env.rst:171 +msgid "Eclipse" +msgstr "" + +#: ../../dev/env.rst:173 +msgid "" +"The most popular Eclipse plugin for Python development is Aptana's `PyDev" +" `_." +msgstr "" + +#: ../../dev/env.rst:178 +msgid "Komodo IDE" +msgstr "" + +#: ../../dev/env.rst:180 +msgid "" +"`Komodo IDE `_ is " +"developed by ActiveState and is a commercial IDE for Windows, Mac, and " +"Linux. `KomodoEdit `_ is the open " +"source alternative." +msgstr "" + +#: ../../dev/env.rst:187 +msgid "Spyder" +msgstr "" + +#: ../../dev/env.rst:189 +msgid "" +"`Spyder `_ is an IDE specifically " +"geared toward working with scientific Python libraries (namely `SciPy " +"`_). It includes integration with pyflakes_, " +"`pylint `_ and `rope `_." +msgstr "" + +#: ../../dev/env.rst:195 +msgid "" +"Spyder is open source (free), offers code completion, syntax " +"highlighting, a class and function browser, and object inspection." +msgstr "" + +#: ../../dev/env.rst:200 +msgid "WingIDE" +msgstr "" + +#: ../../dev/env.rst:202 +msgid "" +"`WingIDE `_ is a Python specific IDE. It runs on " +"Linux, Windows, and Mac (as an X11 application, which frustrates some Mac" +" users)." +msgstr "" + +#: ../../dev/env.rst:205 +msgid "" +"WingIDE offers code completion, syntax highlighting, source browser, " +"graphical debugger and support for version control systems." +msgstr "" + +#: ../../dev/env.rst:210 +msgid "NINJA-IDE" +msgstr "" + +#: ../../dev/env.rst:212 +msgid "" +"`NINJA-IDE `_ (from the recursive acronym: " +"\"Ninja-IDE Is Not Just Another IDE\") is a cross-platform IDE, specially" +" designed to build Python applications, and runs on Linux/X11, Mac OS X, " +"and Windows desktop operating systems. Installers for these platforms can" +" be downloaded from the website." +msgstr "" + +#: ../../dev/env.rst:218 +msgid "" +"NINJA-IDE is open source software (GPLv3 licence) and is developed in " +"Python and Qt. The source files can be downloaded from `GitHub " +"`_." +msgstr "" + +#: ../../dev/env.rst:224 +msgid "Eric (The Eric Python IDE)" +msgstr "" + +#: ../../dev/env.rst:226 +msgid "" +"`Eric `_ is a full featured Python " +"IDE offering source code autocompletion, syntax highlighting, support for" +" version control systems, Python 3 support, integrated web browser, " +"python shell, integrated debugger, and a flexible plug-in system. Written" +" in Python, it is based on the Qt GUI toolkit, integrating the Scintilla " +"editor control. Eric is an open source software project (GPLv3 licence) " +"with more than ten years of active development." +msgstr "" + +#: ../../dev/env.rst:235 +msgid "Mu" +msgstr "" + +#: ../../dev/env.rst:237 +msgid "" +"`Mu `_ is a minimalist Python IDE which can run " +"Python 3 code locally and can also deploy code to the BBC micro:bit and " +"to Adafruit boards running CircuitPython." +msgstr "" + +#: ../../dev/env.rst:241 +msgid "" +"Intended for beginners, mu includes a Python 3 interpreter, and is easy " +"to install on Windows, OS/X and Linux. It runs well on the Raspberry Pi." +msgstr "" + +#: ../../dev/env.rst:244 +msgid "There's an active support community on gitter." +msgstr "" + +#: ../../dev/env.rst:248 +msgid "Interpreter Tools" +msgstr "" + +#: ../../dev/env.rst:252 +msgid "Virtual Environments" +msgstr "" + +#: ../../dev/env.rst:254 +msgid "" +"Virtual Environments provide a powerful way to isolate project package " +"dependencies. This means that you can use packages particular to a Python" +" project without installing them system wide and thus avoiding potential " +"version conflicts." +msgstr "" + +#: ../../dev/env.rst:256 +msgid "" +"To start using and see more information: `Virtual Environments " +"`_ docs." +msgstr "" + +#: ../../dev/env.rst:261 +msgid "pyenv" +msgstr "" + +#: ../../dev/env.rst:263 +msgid "" +"`pyenv `_ is a tool to allow multiple " +"versions of the Python interpreter to be installed at the same time. " +"This solves the problem of having different projects requiring different " +"versions of Python. For example, it becomes very easy to install Python " +"2.7 for compatibility in one project, while still using Python 3.4 as the" +" default interpreter. pyenv isn't just limited to the CPython versions – " +"it will also install PyPy, Anaconda, miniconda, stackless, Jython, and " +"IronPython interpreters." +msgstr "" + +#: ../../dev/env.rst:271 +msgid "" +"pyenv works by filling a ``shims`` directory with fake versions of the " +"Python interpreter (plus other tools like ``pip`` and ``2to3``). When " +"the system looks for a program named ``python``, it looks inside the " +"``shims`` directory first, and uses the fake version, which in turn " +"passes the command on to pyenv. pyenv then works out which version of " +"Python should be run based on environment variables, ``.python-version`` " +"files, and the global default." +msgstr "" + +#: ../../dev/env.rst:278 +msgid "" +"pyenv isn't a tool for managing virtual environments, but there is the " +"plugin `pyenv-virtualenv `_ " +"which automates the creation of different environments, and also makes it" +" possible to use the existing pyenv tools to switch to different " +"environments based on environment variables or ``.python-version`` files." +msgstr "" + +#: ../../dev/env.rst:285 +msgid "Other Tools" +msgstr "" + +#: ../../dev/env.rst:288 +msgid "IDLE" +msgstr "" + +#: ../../dev/env.rst:290 +msgid "" +":ref:`IDLE ` is an integrated development environment that " +"is part of the Python standard distribution. It is completely written in " +"Python and uses the Tkinter GUI toolkit. Though IDLE is not suited for " +"full-blown development using Python, it is quite helpful to try out small" +" Python snippets and experiment with different features in Python." +msgstr "" + +#: ../../dev/env.rst:296 +msgid "It provides the following features:" +msgstr "" + +#: ../../dev/env.rst:298 +msgid "Python Shell Window (interpreter)" +msgstr "" + +#: ../../dev/env.rst:299 +msgid "Multi window text editor that colorizes Python code" +msgstr "" + +#: ../../dev/env.rst:300 +msgid "Minimal debugging facility" +msgstr "" + +#: ../../dev/env.rst:304 +msgid "IPython" +msgstr "" + +#: ../../dev/env.rst:306 +msgid "" +"`IPython `_ provides a rich toolkit to help you make" +" the most out of using Python interactively. Its main components are:" +msgstr "" + +#: ../../dev/env.rst:309 +msgid "Powerful Python shells (terminal- and Qt-based)" +msgstr "" + +#: ../../dev/env.rst:310 +msgid "" +"A web-based notebook with the same core features but support for rich " +"media, text, code, mathematical expressions and inline plots" +msgstr "" + +#: ../../dev/env.rst:312 +msgid "Support for interactive data visualization and use of GUI toolkits" +msgstr "" + +#: ../../dev/env.rst:313 +msgid "Flexible, embeddable interpreters to load into your own projects" +msgstr "" + +#: ../../dev/env.rst:314 +msgid "Tools for high level and interactive parallel computing" +msgstr "" + +#: ../../dev/env.rst:320 +msgid "" +"To download and install IPython with all its optional dependencies for " +"the notebook, qtconsole, tests, and other functionalities:" +msgstr "" + +#: ../../dev/env.rst:327 +msgid "BPython" +msgstr "" + +#: ../../dev/env.rst:329 +msgid "" +"`bpython `_ is an alternative interface" +" to the Python interpreter for Unix-like operating systems. It has the " +"following features:" +msgstr "" + +#: ../../dev/env.rst:333 +msgid "In-line syntax highlighting" +msgstr "" + +#: ../../dev/env.rst:334 +msgid "Readline-like autocomplete with suggestions displayed as you type" +msgstr "" + +#: ../../dev/env.rst:335 +msgid "Expected parameter list for any Python function" +msgstr "" + +#: ../../dev/env.rst:336 +msgid "" +"\"Rewind\" function to pop the last line of code from memory and re-" +"evaluate" +msgstr "" + +#: ../../dev/env.rst:337 +msgid "Send entered code off to a pastebin" +msgstr "" + +#: ../../dev/env.rst:338 +msgid "Save entered code to a file" +msgstr "" + +#: ../../dev/env.rst:339 +msgid "Auto-indentation" +msgstr "" + +#: ../../dev/env.rst:340 +msgid "Python 3 support" +msgstr "" + +#: ../../dev/env.rst:347 +msgid "ptpython" +msgstr "" + +#: ../../dev/env.rst:349 +msgid "" +"`ptpython `_ is a REPL build " +"on top of the `prompt_toolkit `_ library. It is considered to be an alternative to " +"BPython_. Features include:" +msgstr "" + +#: ../../dev/env.rst:353 +msgid "Syntax highlighting" +msgstr "" + +#: ../../dev/env.rst:354 +msgid "Autocompletion" +msgstr "" + +#: ../../dev/env.rst:355 +msgid "Multiline editing" +msgstr "" + +#: ../../dev/env.rst:356 +msgid "Emacs and Vim Modes" +msgstr "" + +#: ../../dev/env.rst:357 +msgid "Embedding REPL inside of your code" +msgstr "" + +#: ../../dev/env.rst:358 +msgid "Syntax validation" +msgstr "" + +#: ../../dev/env.rst:359 +msgid "Tab pages" +msgstr "" + +#: ../../dev/env.rst:360 +msgid "" +"Support for integrating with IPython_'s shell, by installing IPython " +"(``pip install ipython``) and running ``ptipython``." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/dev/pip-virtualenv.po b/locales/zh_CN/LC_MESSAGES/dev/pip-virtualenv.po new file mode 100644 index 000000000..70e589e69 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/dev/pip-virtualenv.po @@ -0,0 +1,177 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../dev/pip-virtualenv.rst:4 +msgid "Further Configuration of pip and Virtualenv" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:9 +msgid "Requiring an active virtual environment for ``pip``" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:11 +msgid "" +"By now it should be clear that using virtual environments is a great way " +"to keep your development environment clean and keeping different " +"projects' requirements separate." +msgstr "" + +#: ../../dev/pip-virtualenv.rst:15 +msgid "" +"When you start working on many different projects, it can be hard to " +"remember to activate the related virtual environment when you come back " +"to a specific project. As a result of this, it is very easy to install " +"packages globally while thinking that you are actually installing the " +"package for the virtual environment of the project. Over time this can " +"result in a messy global package list." +msgstr "" + +#: ../../dev/pip-virtualenv.rst:22 +msgid "" +"In order to make sure that you install packages to your active virtual " +"environment when you use ``pip install``, consider adding the following " +"line to your :file:`~/.bashrc` file:" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:30 +msgid "" +"After saving this change and sourcing the :file:`~/.bashrc` file with " +"``source ~/.bashrc``, pip will no longer let you install packages if you " +"are not in a virtual environment. If you try to use ``pip install`` " +"outside of a virtual environment pip will gently remind you that an " +"activated virtual environment is needed to install packages." +msgstr "" + +#: ../../dev/pip-virtualenv.rst:41 +msgid "" +"You can also do this configuration by editing your :file:`pip.conf` or " +":file:`pip.ini` file. :file:`pip.conf` is used by Unix and Mac OS X " +"operating systems and it can be found at:" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:49 +msgid "" +"Similarly, the :file:`pip.ini` file is used by Windows operating systems " +"and it can be found at:" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:56 +msgid "" +"If you don't have a :file:`pip.conf` or :file:`pip.ini` file at these " +"locations, you can create a new file with the correct name for your " +"operating system." +msgstr "" + +#: ../../dev/pip-virtualenv.rst:59 +msgid "" +"If you already have a configuration file, just add the following line " +"under the ``[global]`` settings to require an active virtual environment:" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:66 +msgid "" +"If you did not have a configuration file, you will need to create a new " +"one and add the following lines to this new file:" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:75 +msgid "" +"You will of course need to install some packages globally (usually ones " +"that you use across different projects consistently) and this can be " +"accomplished by adding the following to your :file:`~/.bashrc` file:" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:85 +msgid "" +"After saving the changes and sourcing your :file:`~/.bashrc` file you can" +" now install packages globally by running ``gpip install``. You can " +"change the name of the function to anything you like, just keep in mind " +"that you will have to use that name when trying to install packages " +"globally with pip." +msgstr "" + +#: ../../dev/pip-virtualenv.rst:91 +msgid "Caching packages for future use" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:93 +msgid "" +"Every developer has preferred libraries and when you are working on a lot" +" of different projects, you are bound to have some overlap between the " +"libraries that you use. For example, you may be using the ``requests`` " +"library in a lot of different projects." +msgstr "" + +#: ../../dev/pip-virtualenv.rst:98 +msgid "" +"It is surely unnecessary to re-download the same packages/libraries each " +"time you start working on a new project (and in a new virtual environment" +" as a result). Fortunately, starting with version 6.0, pip provides an " +"`on-by-default caching mechanism " +"`_ that " +"doesn't need any configuration." +msgstr "" + +#: ../../dev/pip-virtualenv.rst:105 +msgid "" +"When using older versions, you can configure pip in such a way that it " +"tries to reuse already installed packages, too." +msgstr "" + +#: ../../dev/pip-virtualenv.rst:108 +msgid "" +"On Unix systems, you can add the following line to your :file:`.bashrc` " +"or :file:`.bash_profile` file." +msgstr "" + +#: ../../dev/pip-virtualenv.rst:115 +msgid "" +"You can set the path to anywhere you like (as long as you have write " +"access). After adding this line, ``source`` your :file:`.bashrc` (or " +":file:`.bash_profile`) file and you will be all set." +msgstr "" + +#: ../../dev/pip-virtualenv.rst:119 +msgid "" +"Another way of doing the same configuration is via the :file:`pip.conf` " +"or :file:`pip.ini` files, depending on your system. If you are on " +"Windows, you can add the following line to your :file:`pip.ini` file " +"under ``[global]`` settings:" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:127 +msgid "" +"Similarly, on Unix systems you should simply add the following line to " +"your :file:`pip.conf` file under ``[global]`` settings:" +msgstr "" + +#: ../../dev/pip-virtualenv.rst:134 +msgid "" +"Even though you can use any path you like to store your cache, it is " +"recommended that you create a new folder *in* the folder where your " +":file:`pip.conf` or :file:`pip.ini` file lives. If you don't trust " +"yourself with all of this path voodoo, just use the values provided here " +"and you will be fine." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/dev/virtualenvs.po b/locales/zh_CN/LC_MESSAGES/dev/virtualenvs.po new file mode 100644 index 000000000..97d3d4ccc --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/dev/virtualenvs.po @@ -0,0 +1,504 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../dev/virtualenvs.rst:4 +msgid "Pipenv & Virtual Environments" +msgstr "" + +#: ../../dev/virtualenvs.rst:8 +msgid "This tutorial walks you through installing and using Python packages." +msgstr "" + +#: ../../dev/virtualenvs.rst:10 +msgid "" +"It will show you how to install and use the necessary tools and make " +"strong recommendations on best practices. Keep in mind that Python is " +"used for a great many different purposes, and precisely how you want to " +"manage your dependencies may change based on how you decide to publish " +"your software. The guidance presented here is most directly applicable to" +" the development and deployment of network services (including web " +"applications), but is also very well suited to managing development and " +"testing environments for any kind of project." +msgstr "" + +#: ../../dev/virtualenvs.rst:18 +msgid "" +"This guide is written for Python 3, however, these instructions should " +"work fine on Python 2.7—if you are still using it, for some reason." +msgstr "" + +#: ../../dev/virtualenvs.rst:23 +msgid "Make sure you've got Python & pip" +msgstr "" + +#: ../../dev/virtualenvs.rst:25 +msgid "" +"Before you go any further, make sure you have Python and that it's " +"available from your command line. You can check this by simply running:" +msgstr "" + +#: ../../dev/virtualenvs.rst:32 +msgid "" +"You should get some output like ``3.6.2``. If you do not have Python, " +"please install the latest 3.x version from `python.org`_ or refer to the " +"`Installing Python`_ section of this guide." +msgstr "" + +#: ../../dev/virtualenvs.rst:36 +msgid "If you're newcomer and you get an error like this:" +msgstr "" + +#: ../../dev/virtualenvs.rst:45 +msgid "" +"It's because this command is intended to be run in a *shell* (also called" +" a *terminal* or *console*). See the Python for Beginners `getting " +"started tutorial`_ for an introduction to using your operating system's " +"shell and interacting with Python." +msgstr "" + +#: ../../dev/virtualenvs.rst:50 +msgid "" +"Additionally, you'll need to make sure you have `pip`_ available. You can" +" check this by running:" +msgstr "" + +#: ../../dev/virtualenvs.rst:57 +msgid "" +"If you installed Python from source, with an installer from " +"`python.org`_, or via `Homebrew`_ you should already have pip. If you're " +"on Linux and installed using your OS package manager, you may have to " +"`install pip `_ separately." +msgstr "" + +#: ../../dev/virtualenvs.rst:69 +msgid "Installing Pipenv" +msgstr "" + +#: ../../dev/virtualenvs.rst:71 +msgid "" +"`Pipenv`_ is a dependency manager for Python projects. If you're familiar" +" with Node.js' `npm`_ or Ruby's `bundler`_, it is similar in spirit to " +"those tools. While `pip`_ can install Python packages, Pipenv is " +"recommended as it's a higher-level tool that simplifies dependency " +"management for common use cases." +msgstr "" + +#: ../../dev/virtualenvs.rst:77 +msgid "Use ``pip`` to install Pipenv:" +msgstr "" + +#: ../../dev/virtualenvs.rst:84 +msgid "" +"This does a `user installation`_ to prevent breaking any system-wide " +"packages. If ``pipenv`` isn't available in your shell after installation," +" you'll need to add the `user base`_'s binary directory to your ``PATH``." +msgstr "" + +#: ../../dev/virtualenvs.rst:88 +msgid "" +"On Linux and macOS you can find the user base binary directory by running" +" ``python -m site --user-base`` and adding ``bin`` to the end. For " +"example, this will typically print ``~/.local`` (with ``~`` expanded to " +"the absolute path to your home directory) so you'll need to add " +"``~/.local/bin`` to your ``PATH``. You can set your ``PATH`` permanently " +"by `modifying ~/.profile`_." +msgstr "" + +#: ../../dev/virtualenvs.rst:95 +msgid "" +"On Windows you can find the user base binary directory by running ``py -m" +" site --user-site`` and replacing ``site-packages`` with ``Scripts``. For" +" example, this could return " +"``C:\\Users\\Username\\AppData\\Roaming\\Python36\\site-packages`` so you" +" would need to set your ``PATH`` to include " +"``C:\\Users\\Username\\AppData\\Roaming\\Python36\\Scripts``. You can set" +" your user ``PATH`` permanently in the `Control Panel`_. You may need to " +"log out for the ``PATH`` changes to take effect." +msgstr "" + +#: ../../dev/virtualenvs.rst:113 +msgid "Installing packages for your project" +msgstr "" + +#: ../../dev/virtualenvs.rst:115 +msgid "" +"Pipenv manages dependencies on a per-project basis. To install packages, " +"change into your project's directory (or just an empty directory for this" +" tutorial) and run:" +msgstr "" + +#: ../../dev/virtualenvs.rst:124 +msgid "" +"Pipenv will install the excellent `Requests`_ library and create a " +"``Pipfile`` for you in your project's directory. The `Pipfile`_ is used " +"to track which dependencies your project needs in case you need to re-" +"install them, such as when you share your project with others. You should" +" get output similar to this (although the exact paths shown will vary):" +msgstr "" + +#: ../../dev/virtualenvs.rst:163 +msgid "Using installed packages" +msgstr "" + +#: ../../dev/virtualenvs.rst:165 +msgid "" +"Now that Requests is installed you can create a simple ``main.py`` file " +"to use it:" +msgstr "" + +#: ../../dev/virtualenvs.rst:176 +msgid "Then you can run this script using ``pipenv run``:" +msgstr "" + +#: ../../dev/virtualenvs.rst:182 +msgid "You should get output similar to this:" +msgstr "" + +#: ../../dev/virtualenvs.rst:188 +msgid "" +"Using ``$ pipenv run`` ensures that your installed packages are available" +" to your script. It's also possible to spawn a new shell that ensures all" +" commands have access to your installed packages with ``$ pipenv shell``." +msgstr "" + +#: ../../dev/virtualenvs.rst:194 +msgid "Next steps" +msgstr "" + +#: ../../dev/virtualenvs.rst:196 +msgid "" +"Congratulations, you now know how to install and use Python packages! ✨ 🍰" +" ✨" +msgstr "" + +#: ../../dev/virtualenvs.rst:201 +msgid "Lower level: virtualenv" +msgstr "" + +#: ../../dev/virtualenvs.rst:203 +msgid "" +"`virtualenv `_ is a tool to create " +"isolated Python environments. virtualenv creates a folder which contains " +"all the necessary executables to use the packages that a Python project " +"would need." +msgstr "" + +#: ../../dev/virtualenvs.rst:207 +msgid "It can be used standalone, in place of Pipenv." +msgstr "" + +#: ../../dev/virtualenvs.rst:209 +msgid "Install virtualenv via pip:" +msgstr "" + +#: ../../dev/virtualenvs.rst:215 +msgid "Test your installation:" +msgstr "" + +#: ../../dev/virtualenvs.rst:222 ../../dev/virtualenvs.rst:363 +msgid "Basic Usage" +msgstr "" + +#: ../../dev/virtualenvs.rst:224 +msgid "Create a virtual environment for a project:" +msgstr "" + +#: ../../dev/virtualenvs.rst:231 +msgid "" +"``virtualenv venv`` will create a folder in the current directory which " +"will contain the Python executable files, and a copy of the ``pip`` " +"library which you can use to install other packages. The name of the " +"virtual environment (in this case, it was ``venv``) can be anything; " +"omitting the name will place the files in the current directory instead." +msgstr "" + +#: ../../dev/virtualenvs.rst:238 +msgid "" +"'venv' is the general convention used globally. As it is readily " +"available in ignore files (eg: .gitignore')" +msgstr "" + +#: ../../dev/virtualenvs.rst:240 +msgid "" +"This creates a copy of Python in whichever directory you ran the command " +"in, placing it in a folder named :file:`venv`." +msgstr "" + +#: ../../dev/virtualenvs.rst:243 +msgid "" +"You can also use the Python interpreter of your choice (like " +"``python2.7``)." +msgstr "" + +#: ../../dev/virtualenvs.rst:250 +msgid "or change the interpreter globally with an env variable in ``~/.bashrc``:" +msgstr "" + +#: ../../dev/virtualenvs.rst:256 +msgid "To begin using the virtual environment, it needs to be activated:" +msgstr "" + +#: ../../dev/virtualenvs.rst:262 +msgid "" +"The name of the current virtual environment will now appear on the left " +"of the prompt (e.g. ``(venv)Your-Computer:project_folder UserName$``) to " +"let you know that it's active. From now on, any package that you install " +"using pip will be placed in the ``venv`` folder, isolated from the global" +" Python installation." +msgstr "" + +#: ../../dev/virtualenvs.rst:267 +msgid "" +"For Windows, the same command mentioned in step 1 can be used to create a" +" virtual environment. However, activating the environment requires a " +"slightly different command." +msgstr "" + +#: ../../dev/virtualenvs.rst:269 +msgid "Assuming that you are in your project directory:" +msgstr "" + +#: ../../dev/virtualenvs.rst:275 +msgid "Install packages using the ``pip`` command:" +msgstr "" + +#: ../../dev/virtualenvs.rst:281 +msgid "" +"If you are done working in the virtual environment for the moment, you " +"can deactivate it:" +msgstr "" + +#: ../../dev/virtualenvs.rst:288 +msgid "" +"This puts you back to the system's default Python interpreter with all " +"its installed libraries." +msgstr "" + +#: ../../dev/virtualenvs.rst:291 +msgid "" +"To delete a virtual environment, just delete its folder. (In this case, " +"it would be ``rm -rf venv``.)" +msgstr "" + +#: ../../dev/virtualenvs.rst:294 +msgid "" +"After a while, though, you might end up with a lot of virtual " +"environments littered across your system, and it's possible you'll forget" +" their names or where they were placed." +msgstr "" + +#: ../../dev/virtualenvs.rst:299 +msgid "" +"Python has included venv module from version 3.3. For more details: `venv" +" `_." +msgstr "" + +#: ../../dev/virtualenvs.rst:302 +msgid "Other Notes" +msgstr "" + +#: ../../dev/virtualenvs.rst:304 +msgid "" +"Running ``virtualenv`` with the option ``--no-site-packages`` will not " +"include the packages that are installed globally. This can be useful for " +"keeping the package list clean in case it needs to be accessed later. " +"[This is the default behavior for ``virtualenv`` 1.7 and later.]" +msgstr "" + +#: ../../dev/virtualenvs.rst:309 +msgid "" +"In order to keep your environment consistent, it's a good idea to " +"\"freeze\" the current state of the environment packages. To do this, " +"run:" +msgstr "" + +#: ../../dev/virtualenvs.rst:316 +msgid "" +"This will create a :file:`requirements.txt` file, which contains a simple" +" list of all the packages in the current environment, and their " +"respective versions. You can see the list of installed packages without " +"the requirements format using ``pip list``. Later it will be easier for a" +" different developer (or you, if you need to re-create the environment) " +"to install the same packages using the same versions:" +msgstr "" + +#: ../../dev/virtualenvs.rst:327 +msgid "" +"This can help ensure consistency across installations, across " +"deployments, and across developers." +msgstr "" + +#: ../../dev/virtualenvs.rst:330 +msgid "" +"Lastly, remember to exclude the virtual environment folder from source " +"control by adding it to the ignore list (see :ref:`Version Control " +"Ignores`)." +msgstr "" + +#: ../../dev/virtualenvs.rst:336 +msgid "virtualenvwrapper" +msgstr "" + +#: ../../dev/virtualenvs.rst:338 +msgid "" +"`virtualenvwrapper " +"`_ " +"provides a set of commands which makes working with virtual environments " +"much more pleasant. It also places all your virtual environments in one " +"place." +msgstr "" + +#: ../../dev/virtualenvs.rst:342 ../../dev/virtualenvs.rst:354 +msgid "To install (make sure **virtualenv** is already installed):" +msgstr "" + +#: ../../dev/virtualenvs.rst:350 +msgid "" +"(`Full virtualenvwrapper install instructions " +"`_.)" +msgstr "" + +#: ../../dev/virtualenvs.rst:352 +msgid "" +"For Windows, you can use the `virtualenvwrapper-win " +"`_." +msgstr "" + +#: ../../dev/virtualenvs.rst:360 +msgid "In Windows, the default path for WORKON_HOME is %USERPROFILE%\\\\Envs" +msgstr "" + +#: ../../dev/virtualenvs.rst:365 +msgid "Create a virtual environment:" +msgstr "" + +#: ../../dev/virtualenvs.rst:371 +msgid "This creates the :file:`project_folder` folder inside :file:`~/Envs`." +msgstr "" + +#: ../../dev/virtualenvs.rst:373 +msgid "Work on a virtual environment:" +msgstr "" + +#: ../../dev/virtualenvs.rst:379 +msgid "" +"Alternatively, you can make a project, which creates the virtual " +"environment, and also a project directory inside ``$WORKON_HOME``, which " +"is ``cd``-ed into when you ``workon project_folder``." +msgstr "" + +#: ../../dev/virtualenvs.rst:387 +msgid "" +"**virtualenvwrapper** provides tab-completion on environment names. It " +"really helps when you have a lot of environments and have trouble " +"remembering their names." +msgstr "" + +#: ../../dev/virtualenvs.rst:391 +msgid "" +"``workon`` also deactivates whatever environment you are currently in, so" +" you can quickly switch between environments." +msgstr "" + +#: ../../dev/virtualenvs.rst:394 +msgid "Deactivating is still the same:" +msgstr "" + +#: ../../dev/virtualenvs.rst:400 +msgid "To delete:" +msgstr "" + +#: ../../dev/virtualenvs.rst:407 +msgid "Other useful commands" +msgstr "" + +#: ../../dev/virtualenvs.rst:410 +msgid "``lsvirtualenv``" +msgstr "" + +#: ../../dev/virtualenvs.rst:410 +msgid "List all of the environments." +msgstr "" + +#: ../../dev/virtualenvs.rst:414 +msgid "``cdvirtualenv``" +msgstr "" + +#: ../../dev/virtualenvs.rst:413 +msgid "" +"Navigate into the directory of the currently activated virtual " +"environment, so you can browse its :file:`site-packages`, for example." +msgstr "" + +#: ../../dev/virtualenvs.rst:417 +msgid "``cdsitepackages``" +msgstr "" + +#: ../../dev/virtualenvs.rst:417 +msgid "Like the above, but directly into :file:`site-packages` directory." +msgstr "" + +#: ../../dev/virtualenvs.rst:420 +msgid "``lssitepackages``" +msgstr "" + +#: ../../dev/virtualenvs.rst:420 +msgid "Shows contents of :file:`site-packages` directory." +msgstr "" + +#: ../../dev/virtualenvs.rst:422 +msgid "" +"`Full list of virtualenvwrapper commands " +"`_." +msgstr "" + +#: ../../dev/virtualenvs.rst:425 +msgid "virtualenv-burrito" +msgstr "" + +#: ../../dev/virtualenvs.rst:427 +msgid "" +"With `virtualenv-burrito `_, you can have a working virtualenv + virtualenvwrapper " +"environment in a single command." +msgstr "" + +#: ../../dev/virtualenvs.rst:431 +msgid "direnv" +msgstr "" + +#: ../../dev/virtualenvs.rst:432 +msgid "" +"When you ``cd`` into a directory containing a :file:`.env`, `direnv " +"`_ automagically activates the environment." +msgstr "" + +#: ../../dev/virtualenvs.rst:435 +msgid "Install it on Mac OS X using ``brew``:" +msgstr "" + +#: ../../dev/virtualenvs.rst:441 +msgid "On Linux follow the instructions at `direnv.net `_" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/index.po b/locales/zh_CN/LC_MESSAGES/index.po new file mode 100644 index 000000000..650493789 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/index.po @@ -0,0 +1,170 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# xinetzone <735613050@qq.com>, 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-18 16:06+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: xinetzone <735613050@qq.com>\n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../docs/index.rst:6 +msgid "" +"An opinionated guide to the Python programming language and a best " +"practice handbook for the installation, configuration, and usage of " +"Python on a daily basis." +msgstr "" +"这是一本关于 Python 编程语言主观的指南," +"也是一本关于 Python 的安装、配置和日常使用的最佳实践手册。" + +#: ../../docs/index.rst:12 +msgid "The Hitchhiker's Guide to Python!" +msgstr "Python 搭车指南!" + +#: ../../docs/index.rst:14 +msgid "Greetings, Earthling! Welcome to The Hitchhiker's Guide to Python." +msgstr "你好,地球人!欢迎来到 《Python 搭车指南》。" + +#: ../../docs/index.rst:16 +msgid "" +"**This is a living, breathing guide.** If you'd like to contribute, " +"`fork us on GitHub `_!" +msgstr "" +"**这是一份活着的、会呼吸的指南**。" +"如果你想做出贡献,`fork 我们的 GitHub " +"`_ !" + +#: ../../docs/index.rst:19 +msgid "" +"This handcrafted guide exists to provide both novice and expert Python " +"developers a best practice handbook for the installation, configuration, " +"and usage of Python on a daily basis." +msgstr "" +"这本手工制作的指南旨在为 Python 新手和专业开发者提供" +"一本关于 Python 的安装、配置和日常使用的最佳实践手册。" + +#: ../../docs/index.rst:23 +msgid "" +"This guide is **opinionated** in a way that is almost, but not quite, " +"entirely *unlike* Python's official documentation. You won't find a list " +"of every Python web framework available here. Rather, you'll find a nice " +"concise list of highly recommended options." +msgstr "" +"本指南是固执己见的,其方式几乎,但不完全,完全不像 Python 的官方文档。" +"你不会在这里找到所有可用的 Python 网络框架的列表。" +"相反,你会发现一个简明扼要的高度推荐选择清单。" + +#: ../../docs/index.rst:28 +msgid "" +"The use of **Python 3** is *highly* recommended over Python 2. Consider " +"upgrading your applications and infrastructures if you find yourself " +"*still* using Python 2 in production today. If you are using Python 3, " +"congratulations — you are indeed a person of excellent taste. —*Kenneth " +"Reitz*" +msgstr "" +"强烈建议使用 **Python 3**,而不是 Python 2。" +"如果你发现自己今天仍在生产中使用 Python 2,请考虑升级你的应用程序和基础设施。" +"如果你正在使用 Python 3,那么恭喜你 —— 你确实是一个有品位的人。" +"—— *Kenneth Reitz*" + +#: ../../docs/index.rst:31 +msgid "" +"Let's get started! But first, let's make sure you know where your towel " +"is." +msgstr "" +"让我们开始吧! 但首先,让我们确保你知道你的浴巾在哪里。" +"(译者注:towel 浴巾的梗引自著名科幻小说《银河系漫游指南》,大概是说先准备好不起眼但很重要的东西。)" + +#: ../../docs/contents.rst.inc:2 +msgid "Getting Started with Python" +msgstr "Python 入门篇" + +#: ../../docs/contents.rst.inc:4 +msgid "New to Python? Let's properly setup up your Python environment:" +msgstr "初次接触 Python?让我们适当地设置一下你的 Python 环境:" + +#: ../../docs/contents.rst.inc:11 +msgid "Properly Install Python on your system:" +msgstr "在系统中正确安装 Python:" + +#: ../../docs/contents.rst.inc:25 +msgid "Using Virtualenvs with Pipenv:" +msgstr "在 Pipenv 中使用 Virtualenvs:" + +#: ../../docs/contents.rst.inc:34 +msgid "Python Development Environments" +msgstr "Python 开发环境" + +#: ../../docs/contents.rst.inc:36 +msgid "" +"This part of the guide focuses on the Python development environment, and" +" the best-practice tools that are available for writing Python code." +msgstr "" +"这部分指南的重点是 Python 开发环境,以及可用于编写 Python 代码的最佳实践工具。" + +#: ../../docs/contents.rst.inc:50 +msgid "Writing Great Python Code" +msgstr "编写优雅的 Python 代码" + +#: ../../docs/contents.rst.inc:52 +msgid "" +"This part of the guide focuses on the best-practices for writing Python " +"code." +msgstr "" +"这部分指南的重点是编写 Python 代码的最佳实践。" + +#: ../../docs/contents.rst.inc:69 +msgid "Scenario Guide for Python Applications" +msgstr "Python 应用场景指南" + +#: ../../docs/contents.rst.inc:71 +msgid "" +"This part of the guide focuses on tool and module advice based on " +"different scenarios." +msgstr "" +"指南的这一部分侧重于基于不同场景的工具和模块建议。" + +#: ../../docs/contents.rst.inc:98 +msgid "Shipping Great Python Code" +msgstr "运用伟大的 Python 代码" + +#: ../../docs/contents.rst.inc:100 +msgid "This part of the guide focuses on sharing and deploying your Python code." +msgstr "这一部分指南的重点是分享和部署你的 Python 代码。" + +#: ../../docs/contents.rst.inc:111 +msgid "Additional Notes" +msgstr "补充说明" + +#: ../../docs/contents.rst.inc:113 +msgid "" +"This part of the guide, which is mostly prose, begins with some " +"background information about Python, and then focuses on next steps." +msgstr "" +"指南的这一部分主要是序言,首先是关于 Python 的一些背景信息,然后重点是下一步。" + +#: ../../docs/contents.rst.inc:126 +msgid "" +"Notes defined within all diatonic and chromatic musical scales have been " +"intentionally excluded from this list of additional notes. Additionally, " +"this note." +msgstr "" + +#: ../../docs/contents.rst.inc:133 +msgid "Contribution notes and legal information (for those interested)." +msgstr "贡献说明和法律信息(供感兴趣的人参考)。" + diff --git a/locales/zh_CN/LC_MESSAGES/intro/community.po b/locales/zh_CN/LC_MESSAGES/intro/community.po new file mode 100644 index 000000000..274425f70 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/intro/community.po @@ -0,0 +1,214 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../intro/community.rst:6 +msgid "The Community" +msgstr "社区" + +#: ../../intro/community.rst:13 +msgid "BDFL" +msgstr "" + +#: ../../intro/community.rst:15 +msgid "" +"Guido van Rossum, the creator of Python, is often referred to as the BDFL" +" — the Benevolent Dictator For Life." +msgstr "" +"Python 的创始人 Guido van Rossum 通常被称为 BDFL —— 生活的仁慈独裁者。" + +#: ../../intro/community.rst:21 +msgid "Python Software Foundation" +msgstr "Python 软件基金会" + +#: ../../intro/community.rst:24 +msgid "" +"The mission of the Python Software Foundation is to promote, protect, and" +" advance the Python programming language, and to support and facilitate " +"the growth of a diverse and international community of Python " +"programmers." +msgstr "" +"Python 软件基金会的任务是促进、保护和发展 Python 编程语言," +"同时支持和帮助 Python 编程者在多样化、国际化的社区中成长。" + +#: ../../intro/community.rst:28 +msgid "`Learn More about the PSF `_." +msgstr "`了解更多关于 PSF `_。" + +#: ../../intro/community.rst:33 +msgid "PEPs" +msgstr "" + +#: ../../intro/community.rst:35 +msgid "" +"PEPs are *Python Enhancement Proposals*. They describe changes to Python " +"itself, or the standards around it." +msgstr "" +"PEPs 是 *Python 增强提议* (Python Enhancement Proposals)。它们描述了 Python 自身或者相关库的变化。" + +#: ../../intro/community.rst:38 +msgid "There are three different types of PEPs (as defined by :pep:`1`):" +msgstr "这里有三种不同的 PEPs 类型(由 :pep:`1` 定义):" + +#: ../../intro/community.rst:41 +msgid "**Standards**" +msgstr "" + +#: ../../intro/community.rst:41 +msgid "Describes a new feature or implementation." +msgstr "描述一项新特性或者实现。" + +#: ../../intro/community.rst:45 +msgid "**Informational**" +msgstr "" + +#: ../../intro/community.rst:44 +msgid "" +"Describes a design issue, general guidelines, or information to the " +"community." +msgstr "描述一个设计 issue、通用方针、或者社区信息。" + +#: ../../intro/community.rst:49 +msgid "**Process**" +msgstr "" + +#: ../../intro/community.rst:48 +msgid "Describes a process related to Python." +msgstr "描述和 Python 相关的过程。" + +#: ../../intro/community.rst:52 +msgid "Notable PEPs" +msgstr "著名的 PEPs" + +#: ../../intro/community.rst:54 +msgid "There are a few PEPs that could be considered required reading:" +msgstr "这里有少许 PEPs 可以认为是要求必读的:" + +#: ../../intro/community.rst:57 +msgid ":pep:`8`: The Python Style Guide." +msgstr ":pep:`8`:Python 风格指南。" + +#: ../../intro/community.rst:57 +msgid "Read this. All of it. Follow it." +msgstr "完整阅读它,并照着做。" + +#: ../../intro/community.rst:60 +msgid ":pep:`20`: The Zen of Python." +msgstr ":pep:`20`:Python 之禅。" + +#: ../../intro/community.rst:60 +msgid "A list of 19 statements that briefly explain the philosophy behind Python." +msgstr "一个 19 行的小诗,简述了 Python 背后的哲学。" + +#: ../../intro/community.rst:64 +msgid ":pep:`257`: Docstring Conventions." +msgstr ":pep:`257`:文档字符串约定。" + +#: ../../intro/community.rst:63 +msgid "" +"Gives guidelines for semantics and conventions associated with Python " +"docstrings." +msgstr "给出了与 Python 文档字符串相关的语义和约定的指导方针。" + +#: ../../intro/community.rst:66 +msgid "You can read more at `The PEP Index `_." +msgstr "您可以在 `PEP 索引 `_ 上了解更多。" + +#: ../../intro/community.rst:69 +msgid "Submitting a PEP" +msgstr "提交一个 PEP" + +#: ../../intro/community.rst:71 +msgid "" +"PEPs are peer-reviewed and accepted/rejected after much discussion. " +"Anyone can write and submit a PEP for review." +msgstr "" +"PEPs 会被同行审阅,并在大量的讨论后决定接受或拒绝。任何人都能编写和提交 PEP 供以审阅。" + +#: ../../intro/community.rst:74 +msgid "Here's an overview of the PEP acceptance workflow:" +msgstr "这里有一个接受 PEP 的工作流:" + +#: ../../intro/community.rst:81 +msgid "Python Conferences" +msgstr "Python 会议" + +#: ../../intro/community.rst:83 +msgid "" +"The major events for the Python community are developer conferences. The " +"two most notable conferences are PyCon, which is held in the US, and its " +"European sibling, EuroPython." +msgstr "" +"Python 社区主要的事件就是开发者会议。" +"两个最著名的会议就是在美国举办的 PyCon,和在欧洲举办的姊妹版会议 EuroPython。" + +#: ../../intro/community.rst:87 +msgid "" +"A comprehensive list of conferences is maintained at `pycon.org " +"`_." +msgstr "" +"会议的综合列表维护在 `pycon.org `_ 上。" + +#: ../../intro/community.rst:92 +msgid "Python User Groups" +msgstr "Python 用户组" + +#: ../../intro/community.rst:94 +msgid "" +"User Groups are where a bunch of Python developers meet to present or " +"talk about Python topics of interest. A list of local user groups is " +"maintained at the `Python Software Foundation Wiki " +"`_." +msgstr "" +"用户组就是一群 Python 开发者见面现身或讨论感兴趣的 Python 话题的地方。" +"一系列本地用户组维护在 `Python 软件基金会 Wiki `_ 中。" + +#: ../../intro/community.rst:101 +msgid "Online Communities" +msgstr "在线社区" + +#: ../../intro/community.rst:103 +msgid "" +"`PythonistaCafe `_ is an invite-only, " +"online community of Python and software development enthusiasts helping " +"each other succeed and grow. Think of it as a club of mutual improvement " +"for Pythonistas where a broad range of programming questions, career " +"advice, and other topics are discussed every day." +msgstr "" +"`PythonistaCafe `_ 是一个只接受邀请的 Python 和软件开发爱好者的在线社区," +"他们互相帮助,共同成功,共同成长。" +"可以把它看作是 Pythonistas 的一个共同提高的俱乐部,在这里每天都会讨论广泛的编程问题、职业建议和其他话题。" + +#: ../../intro/community.rst:111 +msgid "Python Job Boards" +msgstr "Python 工作公告栏" + +#: ../../intro/community.rst:113 +msgid "" +"`Python Jobs HQ `_ is a Python job board, " +"by Python Developers for Python Developers. The site aggregates Python " +"job postings from across the web and also allows employers to post Python" +" job openings directly on the site." +msgstr "" +"`Python Jobs HQ `_ 是一个面向 Python 开发人员的 Python 工作公告栏。" +"该网站汇总了发布自网络的 Python 职位,并允许雇主直接在网站上发布 Python 职位。" diff --git a/locales/zh_CN/LC_MESSAGES/intro/documentation.po b/locales/zh_CN/LC_MESSAGES/intro/documentation.po new file mode 100644 index 000000000..de3fb067b --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/intro/documentation.po @@ -0,0 +1,81 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../intro/documentation.rst:5 +msgid "Documentation" +msgstr "文档" + +#: ../../intro/documentation.rst:12 +msgid "Official Documentation" +msgstr "官方文档" + +#: ../../intro/documentation.rst:14 +msgid "The official Python Language and Library documentation can be found here:" +msgstr "Python 语言和库的官方文档能够在这里找到:" + +#: ../../intro/documentation.rst:16 +msgid "`Python 2.x `_" +msgstr "" + +#: ../../intro/documentation.rst:17 +msgid "`Python 3.x `_" +msgstr "" + +#: ../../intro/documentation.rst:22 +msgid "Read the Docs" +msgstr "" + +#: ../../intro/documentation.rst:24 +msgid "" +"Read the Docs is a popular community project that hosts documentation for" +" open source software. It holds documentation for many Python modules, " +"both popular and exotic." +msgstr "" +"Read the Docs 是一个流行的社区项目,存放着开源软件的文档。它拥有很多 Python 模块,优秀且流行。" + +#: ../../intro/documentation.rst:28 +msgid "`Read the Docs `_" +msgstr "" + +#: ../../intro/documentation.rst:33 +msgid "pydoc" +msgstr "" + +#: ../../intro/documentation.rst:35 +msgid "" +":program:`pydoc` is a utility that is installed when you install Python. " +"It allows you to quickly retrieve and search for documentation from your " +"shell. For example, if you needed a quick refresher on the :mod:`time` " +"module, pulling up documentation would be as simple as:" +msgstr "" +":program:`pydoc` 是一个在您安装 Python 时跟着安装的工具。" +"它允许您在 shell 中快速检索和查找文档。" +"比如,如果您需要对 :mod:`time` 模块的进行快速回顾,查看文档就是像下面这么简单:" + +#: ../../intro/documentation.rst:44 +msgid "" +"The above command is essentially equivalent to opening the Python REPL " +"and running:" +msgstr "" +"上面的命令和打开 Python REPL 然后运行下面指令是基本等价的:" diff --git a/locales/zh_CN/LC_MESSAGES/intro/duction.po b/locales/zh_CN/LC_MESSAGES/intro/duction.po new file mode 100644 index 000000000..b825b698d --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/intro/duction.po @@ -0,0 +1,174 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# xinetzone <735613050@qq.com>, 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: xinetzone <735613050@qq.com>\n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../intro/duction.rst:5 +msgid "Introduction" +msgstr "介绍" + +#: ../../intro/duction.rst:9 +msgid "From the `official Python website `_:" +msgstr "来自 `Python 官方网站 `_" + +#: ../../intro/duction.rst:11 +msgid "" +"Python is a general-purpose, high-level programming language similar to " +"Tcl, Perl, Ruby, Scheme, or Java. Some of its main key features include:" +msgstr "" +"Python 是一种类似于 Tcl、Perl、Ruby、Scheme 或 Java 通用的高级编程语言。" +"它的一些主要特点包括:" + +#: ../../intro/duction.rst:15 +msgid "**very clear, readable syntax**" +msgstr "**非常清晰、可读的语法**" + +#: ../../intro/duction.rst:17 +msgid "" +"Python's philosophy focuses on readability, from code blocks delineated " +"with significant whitespace to intuitive keywords in place of inscrutable" +" punctuation." +msgstr "" +"Python 的理念侧重于可读性,从用大量空白划定的代码块到用直观的关键词代替难以捉摸的标点符号。" + +#: ../../intro/duction.rst:21 +msgid "" +"**extensive standard libraries and third party modules for virtually any " +"task**" +msgstr "" +"大量的标准库和第三方模块可用于几乎任何任务" + +#: ../../intro/duction.rst:24 +msgid "" +"Python is sometimes described with the words \"batteries included\" " +"because of its extensive `standard library " +"`_, which includes modules for regular " +"expressions, file IO, fraction handling, object serialization, and much " +"more." +msgstr "" +"Python 有时被描述为 \"自带电池(batteries included)\"," +"就是因为它拥有大量的 `标准库 `_," +"这包括正则表达式、文件 IO、分数处理、对象序列化等。" + +#: ../../intro/duction.rst:30 +msgid "" +"Additionally, the `Python Package Index `_ is available" +" for users to submit their packages for widespread use, similar to Perl's" +" `CPAN `_. There is a thriving community of very " +"powerful Python frameworks and tools like the `Django " +"`_ web framework and the `NumPy " +"`_ set of math routines." +msgstr "" + +#: ../../intro/duction.rst:38 +msgid "**integration with other systems**" +msgstr "" + +#: ../../intro/duction.rst:40 +msgid "" +"Python can integrate with `Java libraries `_, " +"enabling it to be used with the rich Java environment that corporate " +"programmers are used to. It can also be `extended by C or C++ modules " +"`_ when speed is of the essence." +msgstr "" + +#: ../../intro/duction.rst:46 +msgid "**ubiquity on computers**" +msgstr "" + +#: ../../intro/duction.rst:48 +msgid "" +"Python is available on Windows, \\*nix, and Mac. It runs wherever the " +"Java virtual machine runs, and the reference implementation CPython can " +"help bring Python to wherever there is a working C compiler." +msgstr "" + +#: ../../intro/duction.rst:52 +msgid "**friendly community**" +msgstr "" + +#: ../../intro/duction.rst:54 +msgid "" +"Python has a vibrant and large :ref:`community ` which " +"maintains wikis, conferences, countless repositories, mailing lists, IRC " +"channels, and so much more. Heck, the Python community is even helping to" +" write this guide!" +msgstr "" + +#: ../../intro/duction.rst:65 +msgid "About This Guide" +msgstr "关于这份指南" + +#: ../../intro/duction.rst:68 +msgid "Purpose" +msgstr "目的" + +#: ../../intro/duction.rst:70 +msgid "" +"The Hitchhiker's Guide to Python exists to provide both novice and expert" +" Python developers a best practice handbook for the installation, " +"configuration, and usage of Python on a daily basis." +msgstr "" +"Hitchhiker 的 Python 指南旨在为 Python 初学者和专家提供一个关于 Python 安装、配置和日常使用的最佳实践手册。" + +#: ../../intro/duction.rst:76 +msgid "By the Community" +msgstr "经由社区" + +#: ../../intro/duction.rst:78 +msgid "" +"This guide is architected and maintained by `Kenneth Reitz " +"`_ in an open fashion. This is a " +"community-driven effort that serves one purpose: to serve the community." +msgstr "" +"本指南由 `Kenneth Reitz `_ 以开放的形式进行架构和维护。" +"这是由社区驱动的成果,服务目标就是服务社区。" + +#: ../../intro/duction.rst:83 +msgid "For the Community" +msgstr "面向社区" + +#: ../../intro/duction.rst:85 +msgid "" +"All contributions to the Guide are welcome, from Pythonistas of all " +"levels. If you think there's a gap in what the Guide covers, fork the " +"Guide on GitHub and submit a pull request." +msgstr "" +"所有水平的 Python 编程者对本指南所有的贡献都是欢迎的。" +"如果您觉得本指南没有覆盖到某些内容,请在 GitHub 上 fork 指南,并提交一个 pull 请求。 + +#: ../../intro/duction.rst:89 +msgid "" +"Contributions are welcome from everyone, whether they're an old hand or a" +" first-time Pythonista, and the authors to the Guide will gladly help if " +"you have any questions about the appropriateness, completeness, or " +"accuracy of a contribution." +msgstr "" +"欢迎每个人的贡献,不管是高手还是新手。" +"如果您对提交的合适性、完成度或者准确度方面有任何疑问,本指南的作者会非常愿意帮助您。" + +#: ../../intro/duction.rst:94 +msgid "" +"To get started working on The Hitchhiker's Guide, see the " +":doc:`/notes/contribute` page." +msgstr "" +"想要开始为 Hitchhiker 的指南做贡献,请见 :doc:`/notes/contribute` 页面。" diff --git a/locales/zh_CN/LC_MESSAGES/intro/learning.po b/locales/zh_CN/LC_MESSAGES/intro/learning.po new file mode 100644 index 000000000..00517580f --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/intro/learning.po @@ -0,0 +1,817 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../intro/learning.rst:5 +msgid "Learning Python" +msgstr "学习 Python" + +#: ../../intro/learning.rst:12 +msgid "Beginner" +msgstr "初学者" + +#: ../../intro/learning.rst:15 +msgid "The Python Tutorial" +msgstr "Python 教程" + +#: ../../intro/learning.rst:17 +msgid "" +"This is the official tutorial. It covers all the basics, and offers a " +"tour of the language and the standard library. Recommended for those who " +"need a quick-start guide to the language." +msgstr "" +"这是官方教程。它涵盖了所有的基础,并提供了 Python 语言和标准库的浏览。推荐给需要快速开始的人。" + +#: ../../intro/learning.rst:21 +msgid "`The Python Tutorial `_" +msgstr "`Python 教程 `_" + +#: ../../intro/learning.rst:24 +msgid "Real Python" +msgstr "" + +#: ../../intro/learning.rst:26 +msgid "" +"Real Python is a repository of free and in-depth Python tutorials created" +" by a diverse team of professional Python developers. At Real Python you " +"can learn all things Python from the ground up. Everything from the " +"absolute basics of Python, to web development and web scraping, to data " +"visualization, and beyond." +msgstr "" +"Real Python 是由各种专业的 Python 开发团队创建的免费且深入的 Python 教程库。" +"在 Real Python 中,您可以从头开始学习 Python 的所有内容。" +"从 Python 的最基础的知识到 Web 开发和 Web 爬取,再到数据可视化等等。" + +#: ../../intro/learning.rst:28 +msgid "`Real Python `_" +msgstr "" + +#: ../../intro/learning.rst:31 +msgid "Python Basics" +msgstr "Python 基础" + +#: ../../intro/learning.rst:33 +msgid "" +"pythonbasics.org is an introductory tutorial for beginners. The tutorial " +"includes exercises. It covers the basics and there are also in-depth " +"lessons like object oriented programming and regular expressions." +msgstr "" +"pythonbasics.org 是初学者的入门教程,包括练习、涵盖了基础知识,还有深入的课程(如面向对象编程和正则表达式)。" + +#: ../../intro/learning.rst:35 +msgid "`Python basics `_" +msgstr "`Python 基础 `_" + +#: ../../intro/learning.rst:38 +msgid "Python for Beginners" +msgstr "" + +#: ../../intro/learning.rst:40 +msgid "" +"thepythonguru.com is a tutorial focused on beginner programmers. It " +"covers many Python concepts in depth. It also teaches you some advanced " +"constructs of Python like lambda expressions and regular expressions. And" +" last it finishes off with the tutorial \"How to access MySQL db using " +"Python\"" +msgstr "" +"thepythonguru.com 是一个专注于初学程序员的教程。它深入涵盖了许多 Python 概念。" +"它还教您一些 Python 的高级概念,如 lambda 表达式、正则表达式等。" +"最后,它以教程 \"如何使用 Python 访问 MySQL 数据库\" 结束。" + +#: ../../intro/learning.rst:44 +msgid "`Python for Beginners `_" +msgstr "" + +#: ../../intro/learning.rst:47 +msgid "Learn Python Interactive Tutorial" +msgstr "" + +#: ../../intro/learning.rst:49 +msgid "" +"Learnpython.org is an easy non-intimidating way to get introduced to " +"Python. The website takes the same approach used on the popular `Try Ruby" +" `_ website. It has an interactive Python" +" interpreter built into the site that allows you to go through the " +"lessons without having to install Python locally." +msgstr "" +"Learnpython.org 是一个简单易懂的了解 Python 的途径。" +"网站采用了和流行的 Try Ruby 相同的方式,有一个交互式的 Python 解释器内建于网站中," +"允许您在学习 Python 课程时不需要在本地安装 Python。" + +#: ../../intro/learning.rst:55 +msgid "`Learn Python `_" +msgstr "" + +#: ../../intro/learning.rst:58 +msgid "Python for You and Me" +msgstr "" + +#: ../../intro/learning.rst:60 +msgid "" +"If you want a more traditional book, *Python For You and Me* is an " +"excellent resource for learning all aspects of the language." +msgstr "" +"如果您想要更加传统的书籍,Python For You and Me 是一个极佳的学习 Python 所有方面的资源。" + +#: ../../intro/learning.rst:63 +msgid "`Python for You and Me `_" +msgstr "" + +#: ../../intro/learning.rst:66 +msgid "Learn Python Step by Step" +msgstr "" + +#: ../../intro/learning.rst:68 +msgid "" +"Techbeamers.com provides step-by-step tutorials to teach Python. Each " +"tutorial is supplemented with logically added coding snippets and equips " +"with a follow-up quiz on the subject learned. There is a section for " +"`Python interview questions `_ to help job seekers. You can also read" +" essential `Python tips `_ and learn `best coding practices " +"`_ for " +"writing quality code. Here, you'll get the right platform to learn Python" +" quickly." +msgstr "" +"Techbeamers.com 提供了手把手的教程讲解 Python。" +"每个教程都补充了相关代码段,并配备了关于所学主题的后续测验。" +"里面的 `Python 面试题 `_ 部分可以帮助求职者。" +"您还可以阅读必备的 `Python 技巧 `_," +"并学习编写高质量代码的 `最佳编程实践 `_。" +"在这里,你将获得快速学习 Python 的正确平台。" + +#: ../../intro/learning.rst:70 +msgid "" +"`Learn Python Basic to Advanced `_" +msgstr "" + +#: ../../intro/learning.rst:74 +msgid "Online Python Tutor" +msgstr "" + +#: ../../intro/learning.rst:76 +msgid "" +"Online Python Tutor gives you a visual step-by-step representation of how" +" your program runs. Python Tutor helps people overcome a fundamental " +"barrier to learning programming by understanding what happens as the " +"computer executes each line of a program's source code." +msgstr "" +"Online Python Tutor 在视觉上向您一步步展示程序是如何运行的。" +"Python Tutor 帮助人们克服 学习编程的基本障碍,让您明白程序源码中的每一行的执行会有怎样的结果。" + +#: ../../intro/learning.rst:82 +msgid "`Online Python Tutor `_" +msgstr "" + +#: ../../intro/learning.rst:85 +msgid "Invent Your Own Computer Games with Python" +msgstr "" + +#: ../../intro/learning.rst:87 +msgid "" +"This beginner's book is for those with no programming experience at all. " +"Each chapter has the source code to a small game, using these example " +"programs to demonstrate programming concepts to give the reader an idea " +"of what programs \"look like\"." +msgstr "" +"这个新手书籍是面向没有任何编程经验的对象。" +"每个章节都有一个小游戏的源码,这些程序例子说明了 编程概念,让读者了解到程序是什么样的。" + +#: ../../intro/learning.rst:92 +msgid "" +"`Invent Your Own Computer Games with Python " +"`_" +msgstr "" + +#: ../../intro/learning.rst:96 +msgid "Hacking Secret Ciphers with Python" +msgstr "" + +#: ../../intro/learning.rst:98 +msgid "" +"This book teaches Python programming and basic cryptography for absolute " +"beginners. The chapters provide the source code for various ciphers, as " +"well as programs that can break them." +msgstr "" +"此书向完全的新手讲解了 Python 编程和基本的密码学知识。所有章节提供了多种加密源码,也提供了破解程序。" + +#: ../../intro/learning.rst:102 +msgid "" +"`Hacking Secret Ciphers with Python " +"`_" +msgstr "" + +#: ../../intro/learning.rst:106 +msgid "Learn Python the Hard Way" +msgstr "" + +#: ../../intro/learning.rst:108 +msgid "" +"This is an excellent beginner programmer's guide to Python. It covers " +"\"hello world\" from the console to the web." +msgstr "" +"这是一部极佳的新手编程者的 Python 指南。它涵盖了从控制台到 web 的 \"hello world\"。" + +#: ../../intro/learning.rst:111 +msgid "`Learn Python the Hard Way `_" +msgstr "" + +#: ../../intro/learning.rst:115 +msgid "Crash into Python" +msgstr "" + +#: ../../intro/learning.rst:117 +msgid "" +"Also known as *Python for Programmers with 3 Hours*, this guide gives " +"experienced developers from other languages a crash course on Python." +msgstr "" +"这个指南也叫 *Python for Programmers with 3 Hours* ," +"它给有其他语言开发经验的开发人员提供一个关于 Python 的快速教程。" + +#: ../../intro/learning.rst:120 +msgid "`Crash into Python `_" +msgstr "" + +#: ../../intro/learning.rst:124 +msgid "Dive Into Python 3" +msgstr "" + +#: ../../intro/learning.rst:126 +msgid "" +"Dive Into Python 3 is a good book for those ready to jump in to Python 3." +" It's a good read if you are moving from Python 2 to 3 or if you already " +"have some experience programming in another language." +msgstr "" +"Dive Into Python 3 对准备使用 Python 3 的人来说是一本不错的书。" +"如果您是从 Python 2 迁移到 Python 3 或者您已经有其他语言的编程经验,那么将会很好阅读。" + +#: ../../intro/learning.rst:130 +msgid "`Dive Into Python 3 `_" +msgstr "" + +#: ../../intro/learning.rst:134 +msgid "Think Python: How to Think Like a Computer Scientist" +msgstr "" + +#: ../../intro/learning.rst:136 +msgid "" +"Think Python attempts to give an introduction to basic concepts in " +"computer science through the use of the Python language. The focus was to" +" create a book with plenty of exercises, minimal jargon, and a section in" +" each chapter devoted to the subject of debugging." +msgstr "" +"Think Python 通过使用 Python 语言来介绍计算机科学中的基本概念。" +"重点是创建一本有大量练习的书,尽量减少专业术语,并在每一章中都有一节专门讨论调试的主题"。" + +#: ../../intro/learning.rst:141 +msgid "" +"While exploring the various features available in the Python language the" +" author weaves in various design patterns and best practices." +msgstr "" +"在探索 Python 语言的各种功能时,作者将各种设计模式和最佳实践编织在一起。" + +#: ../../intro/learning.rst:144 +msgid "" +"The book also includes several case studies which have the reader explore" +" the topics discussed in the book in greater detail by applying those " +"topics to real-world examples. Case studies include assignments in GUI " +"programming and Markov Analysis." +msgstr "" +"此书中还包括一些案例研究,将书中的主题应用到实际例子中,供读者对主题进行更深入的讨论。" +"案例研究包括 GUI 和 Markov 分析的任务。" + +#: ../../intro/learning.rst:149 +msgid "`Think Python `_" +msgstr "" + +#: ../../intro/learning.rst:153 +msgid "Python Koans" +msgstr "" + +#: ../../intro/learning.rst:155 +msgid "" +"Python Koans is a port of Edgecase's Ruby Koans. It uses a test-driven " +"approach to provide an interactive tutorial teaching basic Python " +"concepts. By fixing assertion statements that fail in a test script, " +"this provides sequential steps to learning Python." +msgstr "" +"Python Koans 是 Edgecase's Ruby Koans 的迁移版。" +"它使用测试驱动的方法提供一个交互式的教程,来讲解基本的 Python 概念。" +"通过修复在测试脚本中失败的断言,从而提供连续的步骤来学习 Python。" + +#: ../../intro/learning.rst:160 +msgid "" +"For those used to languages and figuring out puzzles on their own, this " +"can be a fun, attractive option. For those new to Python and programming," +" having an additional resource or reference will be helpful." +msgstr "" +"对于那些使用语言并找出自己的困惑的人来说,这会是个有趣并有吸引力的选择。" +"对于新手来说,拥有一个额外的资源或者参考会是很有用的。" + +#: ../../intro/learning.rst:164 +msgid "`Python Koans `_" +msgstr "" + +#: ../../intro/learning.rst:166 +msgid "" +"More information about test driven development can be found at these " +"resources:" +msgstr "要了解更多关于测试驱动开发的内容,可以查看以下资源:" + +#: ../../intro/learning.rst:168 +msgid "" +"`Test Driven Development `_" +msgstr "" +"`测试驱动开发 `_" + +#: ../../intro/learning.rst:172 +msgid "A Byte of Python" +msgstr "" + +#: ../../intro/learning.rst:174 +msgid "" +"A free introductory book that teaches Python at the beginner level, it " +"assumes no previous programming experience." +msgstr "一本为新手讲解 Python 的免费入门书籍,它假定读者没有编程经验。" + +#: ../../intro/learning.rst:177 +msgid "" +"`A Byte of Python for Python 2.x " +"`_ `A Byte of Python" +" for Python 3.x `_" +msgstr "" + +#: ../../intro/learning.rst:182 +msgid "Computer Science Path on Codecademy" +msgstr "" + +#: ../../intro/learning.rst:184 +msgid "" +"A Codecademy course for the absolute Python beginner. This free and " +"interactive course provides and teaches the basics (and beyond) of Python" +" programming while testing the user's knowledge in between progress. This" +" course also features a built-in interpreter for receiving instant " +"feedback on your learning." +msgstr "" +"此 Codeacademy 课程面向绝对的 Python 初学者。" +"这门免费、互动的课程提供和教授 Python 编程的基础(和以后)的内容,同时测试用户之间知识的进展。" +"课程还内置了一个解释器,用于获取学习过程中的即时反馈。" + +#: ../../intro/learning.rst:189 +msgid "" +"`Computer Science Path on Codecademy " +"`_" +msgstr "" + +#: ../../intro/learning.rst:193 +msgid "Code the blocks" +msgstr "" + +#: ../../intro/learning.rst:195 +msgid "" +"*Code the blocks* provides free and interactive Python tutorials for " +"beginners. It combines Python programming with a 3D environment where you" +" \"place blocks\" and construct structures. The tutorials teach you how " +"to use Python to create progressively more elaborate 3D structures, " +"making the process of learning Python fun and engaging." +msgstr "" +"Code the blocks 为初学者提供免费的交互式 Python 教程。" +"它将 Python 编程与 3D 环境相结合,您可以在其中 \"放置方块\" 并构建结构。" +"本教程将教您如何使用 Python 创建逐渐精细的 3D 结构,从而使得学习 Python 的过程变得有趣和吸引人。" + +#: ../../intro/learning.rst:201 +msgid "`Code the blocks `_" +msgstr "" + +#: ../../intro/learning.rst:206 +msgid "Intermediate" +msgstr "中级" + +#: ../../intro/learning.rst:209 +msgid "Python Tricks: The Book" +msgstr "" + +#: ../../intro/learning.rst:211 +msgid "" +"Discover Python's best practices with simple examples and start writing " +"even more beautiful + Pythonic code. *Python Tricks: The Book* shows you " +"exactly how." +msgstr "" +"通过简单的示例发现 Python 的最佳实践,并开始编写更美观的且 Pythonic 的代码。" +"*Python Tricks: The Book* 向您展示了具体方法。" + +#: ../../intro/learning.rst:213 +msgid "" +"You’ll master intermediate and advanced-level features in Python with " +"practical examples and a clear narrative." +msgstr "您将通过实际示例和清晰的叙述掌握 Python 的中级和高级功能:" + +#: ../../intro/learning.rst:215 +msgid "" +"`Python Tricks: The Book `_" +msgstr "" + +#: ../../intro/learning.rst:218 +msgid "Effective Python" +msgstr "" + +#: ../../intro/learning.rst:220 +msgid "" +"This book contains 59 specific ways to improve writing Pythonic code. At " +"227 pages, it is a very brief overview of some of the most common " +"adaptations programmers need to make to become efficient intermediate " +"level Python programmers." +msgstr "" +"本书包含 59 种具体方法来改进编写 Pythonic 代码。" +"在这 227 页中,这是一个关于程序员需要做的一些最常见的程序以成为高效的中级 Python 程序员的非常简要的概述。" + +#: ../../intro/learning.rst:225 +msgid "`Effective Python `_" +msgstr "" + +#: ../../intro/learning.rst:230 +msgid "Advanced" +msgstr "高级" + +#: ../../intro/learning.rst:233 +msgid "Pro Python" +msgstr "" + +#: ../../intro/learning.rst:235 +msgid "" +"This book is for intermediate to advanced Python programmers who are " +"looking to understand how and why Python works the way it does and how " +"they can take their code to the next level." +msgstr "" +"面向从中级到高级,想明白 Python 是如何以及为何这样工作,如何将代码水平提高一级的 Python 程序员。" + +#: ../../intro/learning.rst:239 +msgid "`Pro Python `_" +msgstr "" + +#: ../../intro/learning.rst:243 +msgid "Expert Python Programming" +msgstr "" + +#: ../../intro/learning.rst:244 +msgid "" +"Expert Python Programming deals with best practices in programming Python" +" and is focused on the more advanced crowd." +msgstr "" +"Expert Python Programming 讲解编写 Python 的最佳实践,并专注更高级的人员。" + +#: ../../intro/learning.rst:247 +msgid "" +"It starts with topics like decorators (with caching, proxy, and context " +"manager case studies), method resolution order, using super() and meta-" +"programming, and general :pep:`8` best practices." +msgstr "" +"它以诸如装饰器(伴随缓存、代理、上下文管理器、案例研究)、方法解析顺序、使用 super()、" +"元编程和一般 :pep:`8` 上的最好实践开始。" + +#: ../../intro/learning.rst:251 +msgid "" +"It has a detailed, multi-chapter case study on writing and releasing a " +"package and eventually an application, including a chapter on using " +"zc.buildout. Later chapters detail best practices such as writing " +"documentation, test-driven development, version control, optimization, " +"and profiling." +msgstr "" +"它有一个详细的、多章的关于编写的案例研究,发行了一个包并最终成为一个应用,包含使用 zc.buildout 的一个章节。" +"后面的章节详细讲述了最佳实践,比如编写文档、测试驱动开发、版本控制、优化和分析。" + +#: ../../intro/learning.rst:256 +msgid "" +"`Expert Python Programming `_" +msgstr "" + +#: ../../intro/learning.rst:260 +msgid "A Guide to Python's Magic Methods" +msgstr "" + +#: ../../intro/learning.rst:262 +msgid "" +"This is a collection of blog posts by Rafe Kettler which explain 'magic " +"methods' in Python. Magic methods are surrounded by double underscores " +"(i.e. __init__) and can make classes and objects behave in different and " +"magical ways." +msgstr "" +"这是 Rafe Kettler 发表博文的集合,解释了 Python 中的 '魔法方法'。" +"魔法方法由双下划线包围 (比如 `__init__`),能够使类和对象表现出不同的、魔法的行为。" + +#: ../../intro/learning.rst:266 +msgid "" +"`A Guide to Python's Magic Methods " +"`_" +msgstr "" + +#: ../../intro/learning.rst:268 +msgid "" +"Rafekettler.com is currently down; you can go to their GitHub version " +"directly. Here you can find a PDF version: `A Guide to Python's Magic " +"Methods (repo on GitHub) " +"`_" +msgstr "" +"Rafekettler.com 目前已关闭,您可以直接访问他们的 GitHub 版本。在这里您可以找到一个 " +"`PDF 版本 `_。" + +#: ../../intro/learning.rst:274 +msgid "For Engineers and Scientists" +msgstr "工程师和科学家" + +#: ../../intro/learning.rst:277 +msgid "A Primer on Scientific Programming with Python" +msgstr "" + +#: ../../intro/learning.rst:279 +msgid "" +"A Primer on Scientific Programming with Python, written by Hans Petter " +"Langtangen, mainly covers Python's usage in the scientific field. In the " +"book, examples are chosen from mathematics and the natural sciences." +msgstr "" +"A Primer on Scientific Programming with Python 由 Hans Petter Langtangen 编写," +"主要涵盖了 Python 在科学领域的使用。在这本书中,例子是从数学和自然科学中选出的。" + +#: ../../intro/learning.rst:283 +msgid "" +"`A Primer on Scientific Programming with Python " +"`_" +msgstr "" + +#: ../../intro/learning.rst:286 +msgid "Numerical Methods in Engineering with Python" +msgstr "" + +#: ../../intro/learning.rst:288 +msgid "" +"Numerical Methods in Engineering with Python, written by Jaan Kiusalaas, " +"puts the emphasis on numerical methods and how to implement them in " +"Python." +msgstr "" +"Numerical Methods in Engineering with Python 由 Jaan Kiusalaas 编写," +"其重点是数值方法以及如何用 Python 来实现。" + +#: ../../intro/learning.rst:291 +msgid "" +"`Numerical Methods in Engineering with Python " +"`_" +msgstr "" + +#: ../../intro/learning.rst:296 +msgid "Miscellaneous Topics" +msgstr "各种各样的话题" + +#: ../../intro/learning.rst:299 +msgid "Problem Solving with Algorithms and Data Structures" +msgstr "" + +#: ../../intro/learning.rst:301 +msgid "" +"Problem Solving with Algorithms and Data Structures covers a range of " +"data structures and algorithms. All concepts are illustrated with Python " +"code along with interactive samples that can be run directly in the " +"browser." +msgstr "" +"Problem Solving with Algorithms and Data Structures 涵盖了一系列数据结构和算法。" +"所有概念都用 Python 代码说明,提供了可在浏览器中直接运行的交互式样例。" + +#: ../../intro/learning.rst:305 +msgid "" +"`Problem Solving with Algorithms and Data Structures " +"`_" +msgstr "" + +#: ../../intro/learning.rst:309 +msgid "Programming Collective Intelligence" +msgstr "" + +#: ../../intro/learning.rst:311 +msgid "" +"Programming Collective Intelligence introduces a wide array of basic " +"machine learning and data mining methods. The exposition is not very " +"mathematically formal, but rather focuses on explaining the underlying " +"intuition and shows how to implement the algorithms in Python." +msgstr "" +"Programming Collective Intelligence 介绍了大量基础的机器学习和数据挖掘方法。" +"其展示在数学上并不是很正式,而是更侧重于解释潜在的直觉,以及展示如何使用 Python 来实现算法。" + +#: ../../intro/learning.rst:316 +msgid "" +"`Programming Collective Intelligence " +"`_" +msgstr "" + +#: ../../intro/learning.rst:320 +msgid "Transforming Code into Beautiful, Idiomatic Python" +msgstr "" + +#: ../../intro/learning.rst:322 +msgid "" +"Transforming Code into Beautiful, Idiomatic Python is a video by Raymond " +"Hettinger. Learn to take better advantage of Python's best features and " +"improve existing code through a series of code transformations: \"When " +"you see this, do that instead.\"" +msgstr "" +"Transforming Code into Beautiful, Idiomatic Python 是由 Raymond Hettinger 制作的视频。" +"通过它可以学习到更好地使用 Python 的最佳特性,通过一系列的代码转换来改进现有代码:\"当您看见这个,就那样去做\"。" + +#: ../../intro/learning.rst:326 +msgid "" +"`Transforming Code into Beautiful, Idiomatic Python " +"`_" +msgstr "" + +#: ../../intro/learning.rst:330 +msgid "Fullstack Python" +msgstr "" + +#: ../../intro/learning.rst:332 +msgid "" +"Fullstack Python offers a complete top-to-bottom resource for web " +"development using Python." +msgstr "Fullstack Python 为使用 Python 进行 Web 开发提供了完整的自顶向下的资源。" + +#: ../../intro/learning.rst:335 +msgid "" +"From setting up the web server, to designing the front-end, choosing a " +"database, optimizing/scaling, etc." +msgstr "范围涵盖从设置 Web 服务器到设计前端、选择数据库、优化/缩放等。" + +#: ../../intro/learning.rst:338 +msgid "" +"As the name suggests, it covers everything you need to build and run a " +"complete web app from scratch." +msgstr "顾名思义,它涵盖了从头开始构建和运行完整的 Web 应用程序所需的所有内容。" + +#: ../../intro/learning.rst:341 +msgid "`Fullstack Python `_" +msgstr "" + +#: ../../intro/learning.rst:345 +msgid "PythonistaCafe" +msgstr "" + +#: ../../intro/learning.rst:347 +msgid "" +"PythonistaCafe is an invite-only, online community of Python and software" +" development enthusiasts helping each other succeed and grow. Think of it" +" as a club of mutual improvement for Pythonistas where a broad range of " +"programming questions, career advice, and other topics are discussed " +"every day." +msgstr "" +"PythonistaCafe 是一个邀请式的在线社区,里面的 Python 和软件开发爱好者互帮互助、彼此成长。" +"可以把它看做是 Pythonista 共同进行改进的俱乐部。" +"在这里,每天都会讨论广泛的编程问题、职业建议,同时也会涉及其他主题。" + +#: ../../intro/learning.rst:349 +msgid "`PythonistaCafe `_" +msgstr "" + +#: ../../intro/learning.rst:354 +msgid "References" +msgstr "参考" + +#: ../../intro/learning.rst:357 +msgid "Python in a Nutshell" +msgstr "" + +#: ../../intro/learning.rst:359 +msgid "" +"Python in a Nutshell, written by Alex Martelli, covers most cross-" +"platform Python usage, from its syntax to built-in libraries to advanced " +"topics such as writing C extensions." +msgstr "" +"Python in a Nutshell 由 Alex Martelli 编写,涵盖了 Python 跨平台的多数用法," +"从它的语法到内建库,再到比如说编写 C 扩展的高级主题。" + +#: ../../intro/learning.rst:363 +msgid "`Python in a Nutshell `_" +msgstr "" + +#: ../../intro/learning.rst:366 +msgid "The Python Language Reference" +msgstr "" + +#: ../../intro/learning.rst:368 +msgid "" +"This is Python's reference manual. It covers the syntax and the core " +"semantics of the language." +msgstr "这是 Python 的参考手册,它涵盖了这门语言的语法和核心语义。" + +#: ../../intro/learning.rst:371 +msgid "" +"`The Python Language Reference " +"`_" +msgstr "" + +#: ../../intro/learning.rst:374 +msgid "Python Essential Reference" +msgstr "" + +#: ../../intro/learning.rst:376 +msgid "" +"Python Essential Reference, written by David Beazley, is the definitive " +"reference guide to Python. It concisely explains both the core language " +"and the most essential parts of the standard library. It covers Python 3 " +"and 2.6 versions." +msgstr "" +"Python Essential Reference,由 David Beazley 撰写,是 Python 的最终参考指南。" +"它简明扼要地解释了标准库的核心语言和最重要的部分。 它涵盖了 Python 3 和 2.6 版本。" + +#: ../../intro/learning.rst:380 +msgid "`Python Essential Reference `_" +msgstr "" + +#: ../../intro/learning.rst:383 +msgid "Python Pocket Reference" +msgstr "" + +#: ../../intro/learning.rst:385 +msgid "" +"Python Pocket Reference, written by Mark Lutz, is an easy to use " +"reference to the core language, with descriptions of commonly used " +"modules and toolkits. It covers Python 3 and 2.6 versions." +msgstr "" +"Python Pocket Reference 由 Mark Lutz 编写,是一个了解核心语言的易于使用的参考," +"介绍了常用的模块和工具集。它涵盖了 Python 3 和 Python 2。" + +#: ../../intro/learning.rst:389 +msgid "" +"`Python Pocket Reference " +"`_" +msgstr "" + +#: ../../intro/learning.rst:392 +msgid "Python Cookbook" +msgstr "" + +#: ../../intro/learning.rst:394 +msgid "" +"Python Cookbook, written by David Beazley and Brian K. Jones, is packed " +"with practical recipes. This book covers the core Python language as well" +" as tasks common to a wide variety of application domains." +msgstr "" +"Python Cookbook 由 David Beazley 和 Brian K. Jones 编写,打包了许多具有实践意义的“食谱”。" +"这本书涵盖了核心 Python 语言,也涵盖了诸多不同应用的常见任务。" + +#: ../../intro/learning.rst:398 +msgid "`Python Cookbook `_" +msgstr "" + +#: ../../intro/learning.rst:401 +msgid "Writing Idiomatic Python" +msgstr "" + +#: ../../intro/learning.rst:403 +msgid "" +"Writing Idiomatic Python, written by Jeff Knupp, contains the most common" +" and important Python idioms in a format that maximizes identification " +"and understanding. Each idiom is presented as a recommendation of a way " +"to write some commonly used piece of code, followed by an explanation of " +"why the idiom is important. It also contains two code samples for each " +"idiom: the \"Harmful\" way to write it and the \"Idiomatic\" way." +msgstr "" +"Writing Idiomatic Python 由 Jeff Knupp 编写,包含了最常见和最重要的 Python 习语," +"其形式尽可能地有辨识度和易于理解。" +"每个习语都是编写一些常用代码片段的推荐方式,其后会解释为什么这个习语是重要的。" +"每个习语均有两个代码样例:\"有害的\" 方式和 \"理想的\" 方式。" + +#: ../../intro/learning.rst:410 +msgid "" +"`For Python 2.7.3+ `_" +msgstr "" + +#: ../../intro/learning.rst:412 +msgid "" +"`For Python 3.3+ `_" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/intro/news.po b/locales/zh_CN/LC_MESSAGES/intro/news.po new file mode 100644 index 000000000..87ece6020 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/intro/news.po @@ -0,0 +1,173 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../intro/news.rst:5 +msgid "News" +msgstr "新闻" + +#: ../../intro/news.rst:12 +msgid "PyCoder’s Weekly" +msgstr "" + +#: ../../intro/news.rst:14 +msgid "" +"PyCoder’s Weekly is a free weekly Python newsletter for Python developers" +" by Python developers (Projects, Articles, News, and Jobs)." +msgstr "" +"PyCoder's Weekly 是一个面向 Python 开发者的免费的每周简讯,包括项目、文章、新闻和工作。" + +#: ../../intro/news.rst:17 +msgid "`PyCoder’s Weekly `_" +msgstr "" + +#: ../../intro/news.rst:22 +msgid "Real Python" +msgstr "" + +#: ../../intro/news.rst:24 +msgid "" +"At Real Python you can learn all things Python from the ground up, with " +"weekly free and in-depth tutorials. Everything from the absolute basics " +"of Python, to web development and web scraping, to data visualization, " +"and beyond." +msgstr "" +"在 Real Python 中,您可以通过每周免费且深入的教程从头开始学习 Python 的所有内容," +"包括 Python 最基础的知识,再到 Web 开发和 Web 爬取,再到数据可视化等等。" + +#: ../../intro/news.rst:26 +msgid "`Real Python `_" +msgstr "" + +#: ../../intro/news.rst:31 +msgid "Planet Python" +msgstr "" + +#: ../../intro/news.rst:33 +msgid "This is an aggregate of Python news from a growing number of developers." +msgstr "这是一个聚合的,展示不断增长的开发者内容的 Python 新闻。" + +#: ../../intro/news.rst:35 +msgid "`Planet Python `_" +msgstr "" + +#: ../../intro/news.rst:40 +msgid "/r/python" +msgstr "" + +#: ../../intro/news.rst:42 +msgid "" +"/r/python is the Reddit Python community where users contribute and vote " +"on Python-related news." +msgstr "" +"/r/python 是 Reddit 的 Python 社区,在这里用户会贡献和投票出和 Python 相关的新闻。" + +#: ../../intro/news.rst:45 +msgid "`/r/python `_" +msgstr "" + +#: ../../intro/news.rst:50 +msgid "Talk Python Podcast" +msgstr "" + +#: ../../intro/news.rst:52 +msgid "The #1 Python-focused podcast covering the people and ideas in Python." +msgstr "第一个关注 Python 的播客,涵盖了 Python 中的人和想法。" + +#: ../../intro/news.rst:54 +msgid "`Talk Python To Me `_" +msgstr "" + +#: ../../intro/news.rst:59 +msgid "Python Bytes Podcast" +msgstr "" + +#: ../../intro/news.rst:61 +msgid "A short-form Python podcast covering recent developer headlines." +msgstr "一个简短的 Python 播客,涵盖了最近的开发人员头条。" + +#: ../../intro/news.rst:63 +msgid "`Python Bytes `_" +msgstr "" + +#: ../../intro/news.rst:68 +msgid "Python Weekly" +msgstr "" + +#: ../../intro/news.rst:70 +msgid "" +"Python Weekly is a free weekly newsletter featuring curated news, " +"articles, new releases, jobs, etc. related to Python." +msgstr "" +"Python Weekly 是一个免费的每周简讯,其特色包括与 Python 相关的新闻、文章、新的发行版本、工作等。" + +#: ../../intro/news.rst:73 +msgid "`Python Weekly `_" +msgstr "" + +#: ../../intro/news.rst:78 +msgid "Python News" +msgstr "" + +#: ../../intro/news.rst:80 +msgid "" +"Python News is the news section in the official Python web site " +"(www.python.org). It briefly highlights the news from the Python " +"community." +msgstr "" +"Python News 是 Python 官方网站的新闻章节。它简短突出来自 Python 社区的新闻。" + +#: ../../intro/news.rst:83 +msgid "`Python News `_" +msgstr "" + +#: ../../intro/news.rst:88 +msgid "Import Python Weekly" +msgstr "" + +#: ../../intro/news.rst:90 +msgid "" +"Weekly Python Newsletter containing Python Articles, Projects, Videos, " +"and Tweets delivered in your inbox. Keep Your Python Programming Skills " +"Updated." +msgstr "" +"Weekly Python Newsletter 包含有 Python 文章、项目、视频、Tweets,并发送到您的收件箱。" +"能够保持您的 Python 编程技能持续更新。" + +#: ../../intro/news.rst:93 +msgid "" +"`Import Python Weekly Newsletter " +"`_" +msgstr "" + +#: ../../intro/news.rst:98 +msgid "Awesome Python Newsletter" +msgstr "" + +#: ../../intro/news.rst:100 +msgid "A weekly overview of the most popular Python news, articles, and packages." +msgstr "每周最流行的 Python 新闻、文章和包的概述。" + +#: ../../intro/news.rst:102 +msgid "`Awesome Python Newsletter `_" +msgstr "" diff --git a/locales/zh_CN/LC_MESSAGES/notes/contribute.po b/locales/zh_CN/LC_MESSAGES/notes/contribute.po new file mode 100644 index 000000000..c0c465a70 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/notes/contribute.po @@ -0,0 +1,63 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../notes/contribute.rst:3 +msgid "Contribute" +msgstr "" + +#: ../../notes/contribute.rst:7 +msgid "Python-guide is under active development, and contributors are welcome." +msgstr "" + +#: ../../notes/contribute.rst:9 +msgid "" +"If you have a feature request, suggestion, or bug report, please open a " +"new issue on GitHub_. To submit patches, please send a pull request on " +"GitHub_. Once your changes get merged back in, you'll automatically be " +"added to the `Contributors List `_." +msgstr "" + +#: ../../notes/contribute.rst:17 +msgid "Style Guide" +msgstr "" + +#: ../../notes/contribute.rst:19 +msgid "For all contributions, please follow the :ref:`guide-style-guide`." +msgstr "" + +#: ../../notes/contribute.rst:26 +msgid "Todo List" +msgstr "" + +#: ../../notes/contribute.rst:28 +msgid "" +"If you'd like to contribute, there's plenty to do. Here's a short todo_ " +"list." +msgstr "" + +#: ../../../TODO.rst:1 +msgid "Establish \"use this\" vs \"alternatives are....\" recommendations" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/notes/license.po b/locales/zh_CN/LC_MESSAGES/notes/license.po new file mode 100644 index 000000000..5a1697470 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/notes/license.po @@ -0,0 +1,35 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../notes/license.rst:3 +msgid "License" +msgstr "" + +#: ../../notes/license.rst:7 +msgid "" +"The Guide is licensed under the `Creative Commons Attribution-" +"NonCommercial-ShareAlike 3.0 Unported license " +"`_." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/notes/styleguide.po b/locales/zh_CN/LC_MESSAGES/notes/styleguide.po new file mode 100644 index 000000000..3b84a44e1 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/notes/styleguide.po @@ -0,0 +1,243 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../notes/styleguide.rst:5 +msgid "The Guide Style Guide" +msgstr "" + +#: ../../notes/styleguide.rst:9 +msgid "" +"As with all documentation, having a consistent format helps make the " +"document more understandable. In order to make The Guide easier to " +"digest, all contributions should fit within the rules of this style guide" +" where appropriate." +msgstr "" + +#: ../../notes/styleguide.rst:14 +msgid "The Guide is written as :ref:`restructuredtext-ref`." +msgstr "" + +#: ../../notes/styleguide.rst:16 +msgid "" +"Parts of The Guide may not yet match this style guide. Feel free to " +"update those parts to be in sync with The Guide Style Guide" +msgstr "" + +#: ../../notes/styleguide.rst:19 +msgid "" +"On any page of the rendered HTML you can click \"Show Source\" to see how" +" authors have styled the page." +msgstr "" + +#: ../../notes/styleguide.rst:25 +msgid "Relevancy" +msgstr "" + +#: ../../notes/styleguide.rst:27 +msgid "" +"Strive to keep any contributions relevant to the :ref:`purpose of The " +"Guide `." +msgstr "" + +#: ../../notes/styleguide.rst:30 +msgid "" +"Avoid including too much information on subjects that don't directly " +"relate to Python development." +msgstr "" + +#: ../../notes/styleguide.rst:32 +msgid "" +"Prefer to link to other sources if the information is already out there. " +"Be sure to describe what and why you are linking." +msgstr "" + +#: ../../notes/styleguide.rst:34 +msgid "" +"`Cite `_ " +"references where needed." +msgstr "" + +#: ../../notes/styleguide.rst:36 +msgid "" +"If a subject isn't directly relevant to Python, but useful in conjunction" +" with Python (e.g., Git, GitHub, Databases), reference by linking to " +"useful resources, and describe why it's useful to Python." +msgstr "" + +#: ../../notes/styleguide.rst:39 +msgid "When in doubt, ask." +msgstr "" + +#: ../../notes/styleguide.rst:44 +msgid "Headings" +msgstr "" + +#: ../../notes/styleguide.rst:46 +msgid "Use the following styles for headings." +msgstr "" + +#: ../../notes/styleguide.rst:48 +msgid "Chapter title:" +msgstr "" + +#: ../../notes/styleguide.rst:56 +msgid "Page title:" +msgstr "" + +#: ../../notes/styleguide.rst:64 +msgid "Section headings:" +msgstr "" + +#: ../../notes/styleguide.rst:71 +msgid "Sub section headings:" +msgstr "" + +#: ../../notes/styleguide.rst:81 +msgid "Prose" +msgstr "" + +#: ../../notes/styleguide.rst:83 +msgid "" +"Wrap text lines at 78 characters. Where necessary, lines may exceed 78 " +"characters, especially if wrapping would make the source text more " +"difficult to read." +msgstr "" + +#: ../../notes/styleguide.rst:87 +msgid "Use Standard American English, not British English." +msgstr "" + +#: ../../notes/styleguide.rst:89 +msgid "" +"Use of the `serial comma `_ " +"(also known as the Oxford comma) is 100% non-optional. Any attempt to " +"submit content with a missing serial comma will result in permanent " +"banishment from this project, due to complete and total lack of taste." +msgstr "" + +#: ../../notes/styleguide.rst:94 +msgid "Banishment? Is this a joke? Hopefully we will never have to find out." +msgstr "" + +#: ../../notes/styleguide.rst:99 +msgid "Code Examples" +msgstr "" + +#: ../../notes/styleguide.rst:101 +msgid "Wrap all code examples at 70 characters to avoid horizontal scrollbars." +msgstr "" + +#: ../../notes/styleguide.rst:103 +msgid "Command line examples:" +msgstr "" + +#: ../../notes/styleguide.rst:112 +msgid "" +"Be sure to include the ``$`` prefix before each line for Unix console " +"examples." +msgstr "" + +#: ../../notes/styleguide.rst:114 +msgid "" +"For Windows console examples, use ``doscon`` or ``powershell`` instead of" +" ``console``, and omit the ``$`` prefix." +msgstr "" + +#: ../../notes/styleguide.rst:117 +msgid "Python interpreter examples:" +msgstr "" + +#: ../../notes/styleguide.rst:127 +msgid "Python examples:" +msgstr "" + +#: ../../notes/styleguide.rst:141 +msgid "Externally Linking" +msgstr "" + +#: ../../notes/styleguide.rst:143 +msgid "Prefer labels for well known subjects (e.g. proper nouns) when linking:" +msgstr "" + +#: ../../notes/styleguide.rst:151 +msgid "" +"Prefer to use descriptive labels with inline links instead of leaving " +"bare links:" +msgstr "" + +#: ../../notes/styleguide.rst:158 +msgid "" +"Avoid using labels such as \"click here\", \"this\", etc., preferring " +"descriptive labels (SEO worthy) instead." +msgstr "" + +#: ../../notes/styleguide.rst:164 +msgid "Linking to Sections in The Guide" +msgstr "" + +#: ../../notes/styleguide.rst:166 +msgid "" +"To cross-reference other parts of this documentation, use the `:ref: " +"`_ keyword and labels." +msgstr "" + +#: ../../notes/styleguide.rst:170 +msgid "" +"To make reference labels more clear and unique, always add a ``-ref`` " +"suffix:" +msgstr "" + +#: ../../notes/styleguide.rst:182 +msgid "Notes and Warnings" +msgstr "" + +#: ../../notes/styleguide.rst:184 +msgid "" +"Make use of the appropriate `admonitions directives `_ when " +"making notes." +msgstr "" + +#: ../../notes/styleguide.rst:187 +msgid "Notes:" +msgstr "" + +#: ../../notes/styleguide.rst:196 +msgid "Warnings:" +msgstr "" + +#: ../../notes/styleguide.rst:205 +msgid "TODOs" +msgstr "" + +#: ../../notes/styleguide.rst:207 +msgid "" +"Please mark any incomplete areas of The Guide with a `todo directive " +"`_. To " +"avoid cluttering the :ref:`todo-list-ref`, use a single ``todo`` for stub" +" documents or large incomplete sections." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/admin.po b/locales/zh_CN/LC_MESSAGES/scenarios/admin.po new file mode 100644 index 000000000..868cb5ac8 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/admin.po @@ -0,0 +1,388 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/admin.rst:4 +msgid "Systems Administration" +msgstr "" + +#: ../../scenarios/admin.rst:11 +msgid "Fabric" +msgstr "" + +#: ../../scenarios/admin.rst:13 +msgid "" +"`Fabric `_ is a library for simplifying system " +"administration tasks. While Chef and Puppet tend to focus on managing " +"servers and system libraries, Fabric is more focused on application level" +" tasks such as deployment." +msgstr "" + +#: ../../scenarios/admin.rst:18 +msgid "Install Fabric:" +msgstr "" + +#: ../../scenarios/admin.rst:24 +msgid "" +"The following code will create two tasks that we can use: " +"``memory_usage`` and ``deploy``. The former will output the memory usage " +"on each machine. The latter will SSH into each server, cd to our project " +"directory, activate the virtual environment, pull the newest codebase, " +"and restart the application server." +msgstr "" + +#: ../../scenarios/admin.rst:47 +msgid "" +"With the previous code saved in a file named :file:`fabfile.py`, we can " +"check memory usage with:" +msgstr "" + +#: ../../scenarios/admin.rst:67 +msgid "and we can deploy with:" +msgstr "" + +#: ../../scenarios/admin.rst:73 +msgid "" +"Additional features include parallel execution, interaction with remote " +"programs, and host grouping." +msgstr "" + +#: ../../scenarios/admin.rst:76 +msgid "`Fabric Documentation `_" +msgstr "" + +#: ../../scenarios/admin.rst:81 +msgid "Salt" +msgstr "" + +#: ../../scenarios/admin.rst:83 +msgid "" +"`Salt `_ is an open source infrastructure " +"management tool. It supports remote command execution from a central " +"point (master host) to multiple hosts (minions). It also supports system " +"states which can be used to configure multiple servers using simple " +"template files." +msgstr "" + +#: ../../scenarios/admin.rst:88 +msgid "Salt supports Python versions 2.6 and 2.7 and can be installed via pip:" +msgstr "" + +#: ../../scenarios/admin.rst:94 +msgid "" +"After configuring a master server and any number of minion hosts, we can " +"run arbitrary shell commands or use pre-built modules of complex commands" +" on our minions." +msgstr "" + +#: ../../scenarios/admin.rst:98 +msgid "" +"The following command lists all available minion hosts, using the ping " +"module." +msgstr "" + +#: ../../scenarios/admin.rst:104 +msgid "" +"The host filtering is accomplished by matching the minion id or using the" +" grains system. The `grains " +"`_ " +"system uses static host information like the operating system version or " +"the CPU architecture to provide a host taxonomy for the Salt modules." +msgstr "" + +#: ../../scenarios/admin.rst:110 +msgid "" +"The following command lists all available minions running CentOS using " +"the grains system:" +msgstr "" + +#: ../../scenarios/admin.rst:117 +msgid "" +"Salt also provides a state system. States can be used to configure the " +"minion hosts." +msgstr "" + +#: ../../scenarios/admin.rst:120 +msgid "" +"For example, when a minion host is ordered to read the following state " +"file, it will install and start the Apache server:" +msgstr "" + +#: ../../scenarios/admin.rst:134 +msgid "" +"State files can be written using YAML, the Jinja2 template system, or " +"pure Python." +msgstr "" + +#: ../../scenarios/admin.rst:136 +msgid "`Salt Documentation `_" +msgstr "" + +#: ../../scenarios/admin.rst:141 +msgid "Psutil" +msgstr "" + +#: ../../scenarios/admin.rst:143 +msgid "" +"`Psutil `_ is an interface to " +"different system information (e.g. CPU, memory, disks, network, users, " +"and processes)." +msgstr "" + +#: ../../scenarios/admin.rst:146 +msgid "" +"Here is an example to be aware of some server overload. If any of the " +"tests (net, CPU) fail, it will send an email." +msgstr "" + +#: ../../scenarios/admin.rst:192 +msgid "" +"A full terminal application like a widely extended top which is based on " +"psutil and with the ability of a client-server monitoring is `glance " +"`_." +msgstr "" + +#: ../../scenarios/admin.rst:199 +msgid "Ansible" +msgstr "" + +#: ../../scenarios/admin.rst:201 +msgid "" +"`Ansible `_ is an open source system automation " +"tool. Its biggest advantage over Puppet or Chef is that it does not " +"require an agent on the client machine. Playbooks are Ansible’s " +"configuration, deployment, and orchestration language and are written in " +"YAML with Jinja2 for templating." +msgstr "" + +#: ../../scenarios/admin.rst:206 +msgid "Ansible supports Python versions 2.6 and 2.7 and can be installed via pip:" +msgstr "" + +#: ../../scenarios/admin.rst:212 +msgid "" +"Ansible requires an inventory file that describes the hosts to which it " +"has access. Below is an example of a host and playbook that will ping all" +" the hosts in the inventory file." +msgstr "" + +#: ../../scenarios/admin.rst:216 +msgid "Here is an example inventory file: :file:`hosts.yml`" +msgstr "" + +#: ../../scenarios/admin.rst:224 +msgid "Here is an example playbook: :file:`ping.yml`" +msgstr "" + +#: ../../scenarios/admin.rst:236 +msgid "To run the playbook:" +msgstr "" + +#: ../../scenarios/admin.rst:242 +msgid "" +"The Ansible playbook will ping all of the servers in the " +":file:`hosts.yml` file. You can also select groups of servers using " +"Ansible. For more information about Ansible, read the `Ansible Docs " +"`_." +msgstr "" + +#: ../../scenarios/admin.rst:246 +msgid "" +"`An Ansible tutorial `_ is also a great and detailed introduction to getting started" +" with Ansible." +msgstr "" + +#: ../../scenarios/admin.rst:252 +msgid "Chef" +msgstr "" + +#: ../../scenarios/admin.rst:254 +msgid "" +"`Chef `_ is a systems and cloud " +"infrastructure automation framework that makes it easy to deploy servers " +"and applications to any physical, virtual, or cloud location. In case " +"this is your choice for configuration management, you will primarily use " +"Ruby to write your infrastructure code." +msgstr "" + +#: ../../scenarios/admin.rst:259 +msgid "" +"Chef clients run on every server that is part of your infrastructure and " +"these regularly check with your Chef server to ensure your system is " +"always aligned and represents the desired state. Since each individual " +"server has its own distinct Chef client, each server configures itself " +"and this distributed approach makes Chef a scalable automation platform." +msgstr "" + +#: ../../scenarios/admin.rst:264 +msgid "" +"Chef works by using custom recipes (configuration elements), implemented " +"in cookbooks. Cookbooks, which are basically packages for infrastructure " +"choices, are usually stored in your Chef server. Read the `DigitalOcean " +"tutorial series `_ " +"on Chef to learn how to create a simple Chef Server." +msgstr "" + +#: ../../scenarios/admin.rst:270 +msgid "" +"To create a simple cookbook the `knife " +"`_ command is used:" +msgstr "" + +#: ../../scenarios/admin.rst:276 +msgid "" +"`Getting started with Chef `_ is a good starting point for Chef Beginners and " +"many community maintained cookbooks that can serve as a good reference or" +" tweaked to serve your infrastructure configuration needs can be found on" +" the `Chef Supermarket `_." +msgstr "" + +#: ../../scenarios/admin.rst:281 +msgid "`Chef Documentation `_" +msgstr "" + +#: ../../scenarios/admin.rst:286 +msgid "Puppet" +msgstr "" + +#: ../../scenarios/admin.rst:288 +msgid "" +"`Puppet `_ is IT Automation and configuration " +"management software from Puppet Labs that allows System Administrators to" +" define the state of their IT Infrastructure, thereby providing an " +"elegant way to manage their fleet of physical and virtual machines." +msgstr "" + +#: ../../scenarios/admin.rst:293 +msgid "" +"Puppet is available both as an Open Source and an Enterprise variant. " +"Modules are small, shareable units of code written to automate or define " +"the state of a system. `Puppet Forge `_ " +"is a repository for modules written by the community for Open Source and " +"Enterprise Puppet." +msgstr "" + +#: ../../scenarios/admin.rst:298 +msgid "" +"Puppet Agents are installed on nodes whose state needs to be monitored or" +" changed. A designated server known as the Puppet Master is responsible " +"for orchestrating the agent nodes." +msgstr "" + +#: ../../scenarios/admin.rst:302 +msgid "" +"Agent nodes send basic facts about the system such as the operating " +"system, kernel, architecture, IP address, hostname, etc. to the Puppet " +"Master. The Puppet Master then compiles a catalog with information " +"provided by the agents on how each node should be configured and sends it" +" to the agent. The agent enforces the change as prescribed in the catalog" +" and sends a report back to the Puppet Master." +msgstr "" + +#: ../../scenarios/admin.rst:309 +msgid "" +"Facter is an interesting tool that ships with Puppet that pulls basic " +"facts about the system. These facts can be referenced as a variable while" +" writing your Puppet modules." +msgstr "" + +#: ../../scenarios/admin.rst:322 +msgid "" +"Writing Modules in Puppet is pretty straight forward. Puppet Manifests " +"together form Puppet Modules. Puppet manifests end with an extension of " +"``.pp``. Here is an example of 'Hello World' in Puppet." +msgstr "" + +#: ../../scenarios/admin.rst:334 +msgid "" +"Here is another example with system based logic. Note how the operating " +"system fact is being used as a variable prepended with the ``$`` sign. " +"Similarly, this holds true for other facts such as hostname which can be " +"referenced by ``$hostname``." +msgstr "" + +#: ../../scenarios/admin.rst:348 +msgid "" +"There are several resource types for Puppet but the package-file-service " +"paradigm is all you need for undertaking the majority of the " +"configuration management. The following Puppet code makes sure that the " +"OpenSSH-Server package is installed in a system and the sshd service is " +"notified to restart every time the sshd configuration file is changed." +msgstr "" + +#: ../../scenarios/admin.rst:379 +msgid "" +"For more information, refer to the `Puppet Labs Documentation " +"`_" +msgstr "" + +#: ../../scenarios/admin.rst:384 +msgid "Blueprint" +msgstr "" + +#: ../../scenarios/admin.rst:386 +msgid "待处理" +msgstr "" + +#: ../../scenarios/admin.rst:386 +msgid "Write about Blueprint" +msgstr "" + +#: ../../scenarios/admin.rst:391 +msgid "Buildout" +msgstr "" + +#: ../../scenarios/admin.rst:393 +msgid "" +"`Buildout `_ is an open source software build " +"tool. Buildout is created using the Python programming language. It " +"implements a principle of separation of configuration from the scripts " +"that do the setting up. Buildout is primarily used to download and set up" +" dependencies in `Python eggs " +"`_ " +"format of the software being developed or deployed. Recipes for build " +"tasks in any environment can be created, and many are already available." +msgstr "" + +#: ../../scenarios/admin.rst:404 +msgid "Shinken" +msgstr "" + +#: ../../scenarios/admin.rst:406 +msgid "" +"`Shinken `_ is a modern, Nagios " +"compatible monitoring framework written in Python. Its main goal is to " +"give users a flexible architecture for their monitoring system that is " +"designed to scale to large environments." +msgstr "" + +#: ../../scenarios/admin.rst:411 +msgid "" +"Shinken is backwards-compatible with the Nagios configuration standard " +"and plugins. It works on any operating system and architecture that " +"supports Python, which includes Windows, Linux, and FreeBSD." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/ci.po b/locales/zh_CN/LC_MESSAGES/scenarios/ci.po new file mode 100644 index 000000000..df799e7fa --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/ci.po @@ -0,0 +1,143 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/ci.rst:4 +msgid "Continuous Integration" +msgstr "" + +#: ../../scenarios/ci.rst:9 +msgid "For advice on writing your tests, see :doc:`/writing/tests`." +msgstr "" + +#: ../../scenarios/ci.rst:14 +msgid "Why?" +msgstr "" + +#: ../../scenarios/ci.rst:16 +msgid "" +"Martin Fowler, who first wrote about `Continuous Integration " +"`_ (short: " +"CI) together with Kent Beck, describes CI as follows:" +msgstr "" + +#: ../../scenarios/ci.rst:19 +msgid "" +"Continuous Integration is a software development practice where members " +"of a team integrate their work frequently, usually each person integrates" +" at least daily - leading to multiple integrations per day. Each " +"integration is verified by an automated build (including test) to detect " +"integration errors as quickly as possible. Many teams find that this " +"approach leads to significantly reduced integration problems and allows a" +" team to develop cohesive software more rapidly." +msgstr "" + +#: ../../scenarios/ci.rst:30 +msgid "Jenkins" +msgstr "" + +#: ../../scenarios/ci.rst:32 +msgid "" +"`Jenkins CI `_ is an extensible Continuous " +"Integration engine. Use it." +msgstr "" + +#: ../../scenarios/ci.rst:37 +msgid "Buildbot" +msgstr "" + +#: ../../scenarios/ci.rst:39 +msgid "" +"`Buildbot `_ is a Python system to " +"automate the compile/test cycle to validate code changes." +msgstr "" + +#: ../../scenarios/ci.rst:45 +msgid "Tox" +msgstr "" + +#: ../../scenarios/ci.rst:47 +msgid "" +"`tox `_ is an automation tool " +"providing packaging, testing, and deployment of Python software right " +"from the console or CI server. It is a generic virtualenv management and " +"test command line tool which provides the following features:" +msgstr "" + +#: ../../scenarios/ci.rst:52 +msgid "" +"Checking that packages install correctly with different Python versions " +"and interpreters" +msgstr "" + +#: ../../scenarios/ci.rst:54 +msgid "" +"Running tests in each of the environments, configuring your test tool of " +"choice" +msgstr "" + +#: ../../scenarios/ci.rst:56 +msgid "" +"Acting as a front-end to Continuous Integration servers, reducing " +"boilerplate and merging CI and shell-based testing" +msgstr "" + +#: ../../scenarios/ci.rst:62 +msgid "Travis-CI" +msgstr "" + +#: ../../scenarios/ci.rst:64 +msgid "" +"`Travis-CI `_ is a distributed CI server which " +"builds tests for open source projects for free. It provides multiple " +"workers to run Python tests on and seamlessly integrates with GitHub. You" +" can even have it comment on your Pull Requests whether this particular " +"changeset breaks the build or not. So, if you are hosting your code on " +"GitHub, Travis-CI is a great and easy way to get started with Continuous " +"Integration." +msgstr "" + +#: ../../scenarios/ci.rst:71 +msgid "" +"In order to get started, add a :file:`.travis.yml` file to your " +"repository with this example content::" +msgstr "" + +#: ../../scenarios/ci.rst:87 +msgid "" +"This will get your project tested on all the listed Python versions by " +"running the given script, and will only build the ``master`` branch. " +"There are a lot more options you can enable, like notifications, before " +"and after steps, and much more. The `Travis-CI docs `_ explain all of these options, and are " +"very thorough." +msgstr "" + +#: ../../scenarios/ci.rst:93 +msgid "" +"In order to activate testing for your project, go to `the Travis-CI site " +"`_ and login with your GitHub account. Then " +"activate your project in your profile settings and you're ready to go. " +"From now on, your project's tests will be run on every push to GitHub." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/cli.po b/locales/zh_CN/LC_MESSAGES/scenarios/cli.po new file mode 100644 index 000000000..7e233d237 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/cli.po @@ -0,0 +1,150 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/cli.rst:4 +msgid "Command-line Applications" +msgstr "" + +#: ../../scenarios/cli.rst:8 +msgid "" +"Command-line applications, also referred to as `Console Applications " +"`_, are computer " +"programs designed to be used from a text interface, such as a `shell " +"`_. Command-line " +"applications usually accept various inputs as arguments, often referred " +"to as parameters or sub-commands, as well as options, often referred to " +"as flags or switches." +msgstr "" + +#: ../../scenarios/cli.rst:15 +msgid "Some popular command-line applications include:" +msgstr "" + +#: ../../scenarios/cli.rst:17 +msgid "" +"`grep `_ - A plain-text data search " +"utility" +msgstr "" + +#: ../../scenarios/cli.rst:18 +msgid "`curl `_ - A tool for data transfer with URL syntax" +msgstr "" + +#: ../../scenarios/cli.rst:19 +msgid "" +"`httpie `_ - A command-line HTTP" +" client, a user-friendly cURL replacement" +msgstr "" + +#: ../../scenarios/cli.rst:21 +msgid "`Git `_ - A distributed version control system" +msgstr "" + +#: ../../scenarios/cli.rst:22 +msgid "" +"`Mercurial `_ - A distributed version " +"control system primarily written in Python" +msgstr "" + +#: ../../scenarios/cli.rst:28 +msgid "Click" +msgstr "" + +#: ../../scenarios/cli.rst:30 +msgid "" +"`click `_ is a Python package for " +"creating command-line interfaces in a composable way with as little code " +"as possible. This “Command-Line Interface Creation Kit” is highly " +"configurable but comes with good defaults out of the box." +msgstr "" + +#: ../../scenarios/cli.rst:38 +msgid "docopt" +msgstr "" + +#: ../../scenarios/cli.rst:40 +msgid "" +"`docopt `_ is a lightweight, highly Pythonic package " +"that allows creating command-line interfaces easily and intuitively, by " +"parsing POSIX-style usage instructions." +msgstr "" + +#: ../../scenarios/cli.rst:47 +msgid "Plac" +msgstr "" + +#: ../../scenarios/cli.rst:49 +msgid "" +"`Plac `_ is a simple wrapper over the " +"Python standard library `argparse " +"`_, which hides most of " +"its complexity by using a declarative interface: the argument parser is " +"inferred rather than written down imperatively. This module targets " +"unsophisticated users, programmers, sysadmins, scientists, and in general" +" people writing throw-away scripts for themselves, who choose to create a" +" command-line interface because it is quick and simple." +msgstr "" + +#: ../../scenarios/cli.rst:60 +msgid "Cliff" +msgstr "" + +#: ../../scenarios/cli.rst:62 +msgid "" +"`Cliff `_ is a framework for" +" building command-line programs. It uses setuptools entry points to " +"provide subcommands, output formatters, and other extensions. The " +"framework is meant to be used to create multi-level commands such as " +"``svn`` and ``git``, where the main program handles some basic argument " +"parsing and then invokes a sub-command to do the work." +msgstr "" + +#: ../../scenarios/cli.rst:72 +msgid "Cement" +msgstr "" + +#: ../../scenarios/cli.rst:74 +msgid "" +"`Cement `_ is an advanced CLI Application " +"Framework. Its goal is to introduce a standard and feature-full platform " +"for both simple and complex command line applications as well as support " +"rapid development needs without sacrificing quality. Cement is flexible, " +"and its use cases span from the simplicity of a micro-framework to the " +"complexity of a mega-framework." +msgstr "" + +#: ../../scenarios/cli.rst:84 +msgid "Python Fire" +msgstr "" + +#: ../../scenarios/cli.rst:86 +msgid "" +"`Python Fire `_ is a library for " +"automatically generating command-line interfaces from absolutely any " +"Python object. It can help debug Python code more easily from the command" +" line, create CLI interfaces to existing code, allow you to interactively" +" explore code in a REPL, and simplify transitioning between Python and " +"Bash (or any other shell)." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/clibs.po b/locales/zh_CN/LC_MESSAGES/scenarios/clibs.po new file mode 100644 index 000000000..4e1e5a62d --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/clibs.po @@ -0,0 +1,130 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/clibs.rst:4 +msgid "Interfacing with C/C++ Libraries" +msgstr "" + +#: ../../scenarios/clibs.rst:11 +msgid "C Foreign Function Interface" +msgstr "" + +#: ../../scenarios/clibs.rst:13 +msgid "" +"`CFFI `_ provides a simple to use" +" mechanism for interfacing with C from both CPython and PyPy. It supports" +" two modes: an inline `ABI `_ compatibility mode " +"(example provided below), which allows you to dynamically load and run " +"functions from executable modules (essentially exposing the same " +"functionality as `LoadLibrary `_ or " +"`dlopen `_), and an API" +" mode, which allows you to build C extension modules." +msgstr "" + +#: ../../scenarios/clibs.rst:21 +msgid "ABI Interaction" +msgstr "" + +#: ../../scenarios/clibs.rst:37 +msgid "ctypes" +msgstr "" + +#: ../../scenarios/clibs.rst:39 +msgid "" +"`ctypes `_ is the de facto" +" standard library for interfacing with C/C++ from CPython, and it " +"provides not only full access to the native C interface of most major " +"operating systems (e.g., kernel32 on Windows, or libc on \\*nix), but " +"also provides support for loading and interfacing with dynamic libraries," +" such as DLLs or shared objects, at runtime. It brings along with it a " +"whole host of types for interacting with system APIs, and allows you to " +"rather easily define your own complex types, such as structs and unions, " +"and allows you to modify things such as padding and alignment, if needed." +" It can be a bit crufty to use, but in conjunction with the `struct " +"`_ module, you are " +"essentially provided full control over how your data types get translated" +" into something usable by a pure C/C++ method." +msgstr "" + +#: ../../scenarios/clibs.rst:53 +msgid "Struct Equivalents" +msgstr "" + +#: ../../scenarios/clibs.rst:55 +msgid ":file:`MyStruct.h`" +msgstr "" + +#: ../../scenarios/clibs.rst:65 +msgid ":file:`MyStruct.py`" +msgstr "" + +#: ../../scenarios/clibs.rst:78 +msgid "SWIG" +msgstr "" + +#: ../../scenarios/clibs.rst:80 +msgid "" +"`SWIG `_, though not strictly Python focused (it " +"supports a large number of scripting languages), is a tool for generating" +" bindings for interpreted languages from C/C++ header files. It is " +"extremely simple to use: the consumer simply needs to define an interface" +" file (detailed in the tutorial and documentations), include the " +"requisite C/C++ headers, and run the build tool against them. While it " +"does have some limits (it currently seems to have issues with a small " +"subset of newer C++ features, and getting template-heavy code to work can" +" be a bit verbose), it provides a great deal of power and exposes lots of" +" features to Python with little effort. Additionally, you can easily " +"extend the bindings SWIG creates (in the interface file) to overload " +"operators and built-in methods, effectively re- cast C++ exceptions to be" +" catchable by Python, etc." +msgstr "" + +#: ../../scenarios/clibs.rst:94 +msgid "Example: Overloading __repr__" +msgstr "" + +#: ../../scenarios/clibs.rst:96 +msgid ":file:`MyClass.h`" +msgstr "" + +#: ../../scenarios/clibs.rst:110 +msgid ":file:`myclass.i`" +msgstr "" + +#: ../../scenarios/clibs.rst:135 +msgid "Boost.Python" +msgstr "" + +#: ../../scenarios/clibs.rst:137 +msgid "" +"`Boost.Python `_ " +"requires a bit more manual work to expose C++ object functionality, but " +"it is capable of providing all the same features SWIG does and then some," +" to include providing wrappers to access PyObjects in C++, extracting " +"SWIG wrapper objects, and even embedding bits of Python into your C++ " +"code." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/client.po b/locales/zh_CN/LC_MESSAGES/scenarios/client.po new file mode 100644 index 000000000..313f5aa65 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/client.po @@ -0,0 +1,111 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/client.rst:4 +msgid "Network Applications" +msgstr "" + +#: ../../scenarios/client.rst:11 +msgid "HTTP" +msgstr "" + +#: ../../scenarios/client.rst:13 +msgid "" +"The Hypertext Transfer Protocol (HTTP) is an application protocol for " +"distributed, collaborative, hypermedia information systems. HTTP is the " +"foundation of data communication for the World Wide Web." +msgstr "" + +#: ../../scenarios/client.rst:18 +msgid "Requests" +msgstr "" + +#: ../../scenarios/client.rst:20 +msgid "" +"Python’s standard urllib2 module provides most of the HTTP capabilities " +"you need, but the API is thoroughly broken. It was built for a different " +"time — and a different web. It requires an enormous amount of work (even " +"method overrides) to perform the simplest of tasks." +msgstr "" + +#: ../../scenarios/client.rst:25 +msgid "" +"Requests takes all of the work out of Python HTTP — making your " +"integration with web services seamless. There’s no need to manually add " +"query strings to your URLs, or to form-encode your POST data. Keep-alive " +"and HTTP connection pooling are 100% automatic, powered by urllib3, which" +" is embedded within Requests." +msgstr "" + +#: ../../scenarios/client.rst:31 +msgid "`Documentation `_" +msgstr "" + +#: ../../scenarios/client.rst:32 +msgid "`PyPi `_" +msgstr "" + +#: ../../scenarios/client.rst:33 +msgid "`GitHub `_" +msgstr "" + +#: ../../scenarios/client.rst:38 +msgid "Distributed Systems" +msgstr "" + +#: ../../scenarios/client.rst:42 +msgid "ZeroMQ" +msgstr "" + +#: ../../scenarios/client.rst:44 +msgid "" +"ØMQ (also spelled ZeroMQ, 0MQ or ZMQ) is a high-performance asynchronous " +"messaging library aimed at use in scalable distributed or concurrent " +"applications. It provides a message queue, but unlike message-oriented " +"middleware, a ØMQ system can run without a dedicated message broker. The " +"library is designed to have a familiar socket-style API." +msgstr "" + +#: ../../scenarios/client.rst:51 +msgid "RabbitMQ" +msgstr "" + +#: ../../scenarios/client.rst:53 +msgid "" +"RabbitMQ is an open source message broker software that implements the " +"Advanced Message Queuing Protocol (AMQP). The RabbitMQ server is written" +" in the Erlang programming language and is built on the Open Telecom " +"Platform framework for clustering and failover. Client libraries to " +"interface with the broker are available for all major programming " +"languages." +msgstr "" + +#: ../../scenarios/client.rst:59 +msgid "`Homepage `_" +msgstr "" + +#: ../../scenarios/client.rst:60 +msgid "`GitHub Organization `_" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/crypto.po b/locales/zh_CN/LC_MESSAGES/scenarios/crypto.po new file mode 100644 index 000000000..bacccadfa --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/crypto.po @@ -0,0 +1,100 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/crypto.rst:4 +msgid "Cryptography" +msgstr "" + +#: ../../scenarios/crypto.rst:11 +msgid "cryptography" +msgstr "" + +#: ../../scenarios/crypto.rst:13 +msgid "" +"`cryptography `_ is an actively " +"developed library that provides cryptographic recipes and primitives. It " +"supports Python 2.6-2.7, Python 3.3+, and PyPy." +msgstr "" + +#: ../../scenarios/crypto.rst:18 +msgid "" +"cryptography is divided into two layers of recipes and hazardous " +"materials (hazmat). The recipes layer provides a simple API for proper " +"symmetric encryption and the hazmat layer provides low-level " +"cryptographic primitives." +msgstr "" + +#: ../../scenarios/crypto.rst:25 ../../scenarios/crypto.rst:57 +msgid "Installation" +msgstr "" + +#: ../../scenarios/crypto.rst:32 ../../scenarios/crypto.rst:62 +msgid "Example" +msgstr "" + +#: ../../scenarios/crypto.rst:34 +msgid "Example code using high level symmetric encryption recipe:" +msgstr "" + +#: ../../scenarios/crypto.rst:47 +msgid "GPGME bindings" +msgstr "" + +#: ../../scenarios/crypto.rst:49 +msgid "" +"The `GPGME Python bindings " +"`_ provide" +" Pythonic access to `GPG Made Easy " +"`_, a C API for the " +"entire GNU Privacy Guard suite of projects, including GPG, libgcrypt, and" +" gpgsm (the S/MIME engine). It supports Python 2.6, 2.7, 3.4, and above. " +"Depends on the SWIG C interface for Python as well as the GnuPG software " +"and libraries." +msgstr "" + +#: ../../scenarios/crypto.rst:52 +msgid "" +"A more comprehensive `GPGME Python Bindings HOWTO " +"`_" +" is available with the source, and an HTML version is available `at " +"http://files.au.adversary.org " +"`_. Python" +" 3 sample scripts from the examples in the HOWTO are also provided with " +"the source and are accessible `at gnupg.org " +"`_." +msgstr "" + +#: ../../scenarios/crypto.rst:54 +msgid "" +"Available under the same terms as the rest of the GnuPG Project: GPLv2 " +"and LGPLv2.1, both with the \"or any later version\" clause." +msgstr "" + +#: ../../scenarios/crypto.rst:59 +msgid "" +"Included by default when compiling GPGME if the configure script locates " +"a supported python version (which it will if it's in $PATH during " +"configuration)." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/db.po b/locales/zh_CN/LC_MESSAGES/scenarios/db.po new file mode 100644 index 000000000..a137d8eb7 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/db.po @@ -0,0 +1,170 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/db.rst:4 +msgid "Databases" +msgstr "" + +#: ../../scenarios/db.rst:11 +msgid "DB-API" +msgstr "" + +#: ../../scenarios/db.rst:13 +msgid "" +"The Python Database API (DB-API) defines a standard interface for Python " +"database access modules. It's documented in :pep:`249`. Nearly all Python" +" database modules such as `sqlite3`, `psycopg`, and `mysql-python` " +"conform to this interface." +msgstr "" + +#: ../../scenarios/db.rst:18 +msgid "" +"Tutorials that explain how to work with modules that conform to this " +"interface can be found `here " +"`__ " +"and `here " +"`__." +msgstr "" + +#: ../../scenarios/db.rst:25 +msgid "SQLAlchemy" +msgstr "" + +#: ../../scenarios/db.rst:27 +msgid "" +"`SQLAlchemy `_ is a commonly used database " +"toolkit. Unlike many database libraries it not only provides an ORM layer" +" but also a generalized API for writing database-agnostic code without " +"SQL." +msgstr "" + +#: ../../scenarios/db.rst:38 +msgid "Records" +msgstr "" + +#: ../../scenarios/db.rst:40 +msgid "" +"`Records `_ is minimalist SQL " +"library, designed for sending raw SQL queries to various databases. Data " +"can be used programmatically or exported to a number of useful data " +"formats." +msgstr "" + +#: ../../scenarios/db.rst:48 +msgid "Also included is a command-line tool for exporting SQL data." +msgstr "" + +#: ../../scenarios/db.rst:53 +msgid "PugSQL" +msgstr "" + +#: ../../scenarios/db.rst:55 +msgid "" +"`PugSQL `_ is a simple Python interface for " +"organizing and using parameterized, handwritten SQL. It is an anti-ORM " +"that is philosophically lo-fi, but it still presents a clean interface in" +" Python." +msgstr "" + +#: ../../scenarios/db.rst:66 +msgid "Django ORM" +msgstr "" + +#: ../../scenarios/db.rst:68 +msgid "" +"The Django ORM is the interface used by `Django " +"`_ to provide database access." +msgstr "" + +#: ../../scenarios/db.rst:71 +msgid "" +"It's based on the idea of `models `_, an abstraction that makes it easier to manipulate " +"data in Python." +msgstr "" + +#: ../../scenarios/db.rst:75 +msgid "The basics:" +msgstr "" + +#: ../../scenarios/db.rst:77 +msgid "Each model is a Python class that subclasses django.db.models.Model." +msgstr "" + +#: ../../scenarios/db.rst:78 +msgid "Each attribute of the model represents a database field." +msgstr "" + +#: ../../scenarios/db.rst:79 +msgid "" +"Django gives you an automatically-generated database-access API; see " +"`Making queries " +"`__." +msgstr "" + +#: ../../scenarios/db.rst:85 +msgid "peewee" +msgstr "" + +#: ../../scenarios/db.rst:87 +msgid "" +"`peewee `_ is another ORM with a " +"focus on being lightweight with support for Python 2.6+ and 3.2+ which " +"supports SQLite, MySQL, and PostgreSQL by default. The `model layer " +"`_ is similar to that of the Django ORM and it has `SQL-like " +"methods `_ to query data. While SQLite, MySQL, and PostgreSQL " +"are supported out-of-the-box, there is a `collection of add-ons " +"`_" +" available." +msgstr "" + +#: ../../scenarios/db.rst:100 +msgid "PonyORM" +msgstr "" + +#: ../../scenarios/db.rst:102 +msgid "" +"`PonyORM `_ is an ORM that takes a different " +"approach to querying the database. Instead of writing an SQL-like " +"language or boolean expressions, Python's generator syntax is used. " +"There's also a graphical schema editor that can generate PonyORM entities" +" for you. It supports Python 2.6+ and Python 3.3+ and can connect to " +"SQLite, MySQL, PostgreSQL, and Oracle." +msgstr "" + +#: ../../scenarios/db.rst:111 +msgid "SQLObject" +msgstr "" + +#: ../../scenarios/db.rst:113 +msgid "" +"`SQLObject `_ is yet another ORM. It supports " +"a wide variety of databases: common database systems like MySQL, " +"PostgreSQL, and SQLite and more exotic systems like SAP DB, SyBase, and " +"Microsoft SQL Server. It only supports Python 2 from Python 2.6 upwards." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/gui.po b/locales/zh_CN/LC_MESSAGES/scenarios/gui.po new file mode 100644 index 000000000..412c43cde --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/gui.po @@ -0,0 +1,270 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/gui.rst:4 +msgid "GUI Applications" +msgstr "" + +#: ../../scenarios/gui.rst:9 +msgid "Alphabetical list of GUI Applications." +msgstr "" + +#: ../../scenarios/gui.rst:14 +msgid "Camelot" +msgstr "" + +#: ../../scenarios/gui.rst:16 +msgid "" +"`Camelot `_ provides components for " +"building applications on top of Python, SQLAlchemy, and Qt. It is " +"inspired by the Django admin interface." +msgstr "" + +#: ../../scenarios/gui.rst:20 +msgid "" +"The main resource for information is the website: http://www.python-" +"camelot.com and the mailing list https://groups.google.com/forum/#!forum" +"/project-camelot." +msgstr "" + +#: ../../scenarios/gui.rst:27 +msgid "Cocoa" +msgstr "" + +#: ../../scenarios/gui.rst:29 +msgid "" +"The Cocoa framework is only available on OS X. Don't pick this if you're " +"writing a cross-platform application!" +msgstr "" + +#: ../../scenarios/gui.rst:34 +msgid "GTk" +msgstr "" + +#: ../../scenarios/gui.rst:36 +msgid "" +"PyGTK provides Python bindings for the GTK+ toolkit. However, it has been" +" superseded by PyGObject. PyGTK should not be used for new projects and " +"existing projects should be ported to PyGObject." +msgstr "" + +#: ../../scenarios/gui.rst:41 +msgid "PyGObject aka (PyGi)" +msgstr "" + +#: ../../scenarios/gui.rst:43 +msgid "" +"`PyGObject `_ provides Python " +"bindings which gives access to the entire GNOME software platform. It is " +"fully compatible with GTK+ 3. Here is a tutorial to get started with " +"`Python GTK+ 3 Tutorial `_." +msgstr "" + +#: ../../scenarios/gui.rst:48 +msgid "`API Reference `_" +msgstr "" + +#: ../../scenarios/gui.rst:53 +msgid "Kivy" +msgstr "" + +#: ../../scenarios/gui.rst:55 +msgid "" +"`Kivy `_ is a Python library for development of multi-" +"touch enabled media rich applications. The aim is to allow for quick and " +"easy interaction design and rapid prototyping, while making your code " +"reusable and deployable." +msgstr "" + +#: ../../scenarios/gui.rst:60 +msgid "" +"Kivy is written in Python, based on OpenGL, and supports different input " +"devices such as: Mouse, Dual Mouse, TUIO, WiiMote, WM_TOUCH, HIDtouch, " +"Apple's products, and so on." +msgstr "" + +#: ../../scenarios/gui.rst:64 +msgid "" +"Kivy is actively being developed by a community and is free to use. It " +"operates on all major platforms (Linux, OS X, Windows, Android)." +msgstr "" + +#: ../../scenarios/gui.rst:67 +msgid "The main resource for information is the website: http://kivy.org" +msgstr "" + +#: ../../scenarios/gui.rst:72 +msgid "PyObjC" +msgstr "" + +#: ../../scenarios/gui.rst:74 +msgid "" +"Only available on OS X. Don't pick this if you're writing a cross-" +"platform application." +msgstr "" + +#: ../../scenarios/gui.rst:79 +msgid "PySide" +msgstr "" + +#: ../../scenarios/gui.rst:81 +msgid "" +"PySide is a Python binding of the cross-platform GUI toolkit Qt. The " +"package name depends on the major Qt version (`PySide` for Qt4, `PySide2`" +" for Qt5, and `PySide6` for Qt6). This set of bindings is developed by " +"`The Qt Company `_." +msgstr "" + +#: ../../scenarios/gui.rst:90 +msgid "https://pyside.org" +msgstr "" + +#: ../../scenarios/gui.rst:95 +msgid "PyQt" +msgstr "" + +#: ../../scenarios/gui.rst:97 +msgid "" +"If your software does not fully comply with the GPL you will need a " +"commercial license!" +msgstr "" + +#: ../../scenarios/gui.rst:99 +msgid "PyQt provides Python bindings for the Qt Framework (see below)." +msgstr "" + +#: ../../scenarios/gui.rst:101 +msgid "http://www.riverbankcomputing.co.uk/software/pyqt/download" +msgstr "" + +#: ../../scenarios/gui.rst:106 +msgid "Pyjs Desktop (formerly Pyjamas Desktop)" +msgstr "" + +#: ../../scenarios/gui.rst:108 +msgid "" +"Pyjs Desktop is a application widget set for desktop and a cross-platform" +" framework. It allows the exact same Python web application source code " +"to be executed as a standalone desktop application." +msgstr "" + +#: ../../scenarios/gui.rst:113 +msgid "The main website: `pyjs `_." +msgstr "" + +#: ../../scenarios/gui.rst:118 +msgid "Qt" +msgstr "" + +#: ../../scenarios/gui.rst:120 +msgid "" +"`Qt `_ is a cross-platform application framework " +"that is widely used for developing software with a GUI but can also be " +"used for non-GUI applications." +msgstr "" + +#: ../../scenarios/gui.rst:127 +msgid "PySimpleGUI" +msgstr "" + +#: ../../scenarios/gui.rst:129 +msgid "" +"`PySimpleGUI `_ is a wrapper for " +"Tkinter and Qt (others on the way). The amount of code required to " +"implement custom GUIs is much shorter using PySimpleGUI than if the same " +"GUI were written directly using Tkinter or Qt. PySimpleGUI code can be " +"\"ported\" between GUI frameworks by changing import statements." +msgstr "" + +#: ../../scenarios/gui.rst:139 +msgid "" +"PySimpleGUI is contained in a single PySimpleGUI.py file. Should pip " +"installation be impossible, copying the PySimpleGUI.py file into a " +"project's folder is all that's required to import and begin using." +msgstr "" + +#: ../../scenarios/gui.rst:146 +msgid "Toga" +msgstr "" + +#: ../../scenarios/gui.rst:148 +msgid "" +"`Toga `_ is a Python native, OS " +"native, cross platform GUI toolkit. Toga consists of a library of base " +"components with a shared interface to simplify platform-agnostic GUI " +"development." +msgstr "" + +#: ../../scenarios/gui.rst:152 +msgid "" +"Toga is available on macOS, Windows, Linux (GTK), and mobile platforms " +"such as Android and iOS." +msgstr "" + +#: ../../scenarios/gui.rst:158 +msgid "Tk" +msgstr "" + +#: ../../scenarios/gui.rst:160 +msgid "" +"Tkinter is a thin object-oriented layer on top of Tcl/Tk. **It has the " +"advantage of being included with the Python standard library, making it " +"the most convenient and compatible toolkit to program with.**" +msgstr "" + +#: ../../scenarios/gui.rst:164 +msgid "" +"Both Tk and Tkinter are available on most Unix platforms, as well as on " +"Windows and Macintosh systems. Starting with the 8.0 release, Tk offers " +"native look and feel on all platforms." +msgstr "" + +#: ../../scenarios/gui.rst:168 +msgid "" +"There's a good multi-language Tk tutorial with Python examples at `TkDocs" +" `_. There's more information " +"available on the `Python Wiki `_." +msgstr "" + +#: ../../scenarios/gui.rst:175 +msgid "wxPython" +msgstr "" + +#: ../../scenarios/gui.rst:177 +msgid "" +"wxPython is a GUI toolkit for the Python programming language. It allows " +"Python programmers to create programs with a robust, highly functional " +"graphical user interface, simply and easily. It is implemented as a " +"Python extension module (native code) that wraps the popular wxWidgets " +"cross platform GUI library, which is written in C++." +msgstr "" + +#: ../../scenarios/gui.rst:183 +msgid "" +"**Install (Stable) wxPython** *go to " +"https://www.wxpython.org/pages/downloads/ and download the appropriate " +"package for your OS.*" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/imaging.po b/locales/zh_CN/LC_MESSAGES/scenarios/imaging.po new file mode 100644 index 000000000..92d2b1f0b --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/imaging.po @@ -0,0 +1,115 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/imaging.rst:4 +msgid "Image Manipulation" +msgstr "" + +#: ../../scenarios/imaging.rst:8 +msgid "" +"Most image processing and manipulation techniques can be carried out " +"effectively using two libraries: Python Imaging Library (PIL) and Open " +"Source Computer Vision (OpenCV)." +msgstr "" + +#: ../../scenarios/imaging.rst:12 +msgid "A brief description of both is given below." +msgstr "" + +#: ../../scenarios/imaging.rst:17 +msgid "Python Imaging Library" +msgstr "" + +#: ../../scenarios/imaging.rst:19 +msgid "" +"The `Python Imaging Library `_, " +"or PIL for short, is one of the core libraries for image manipulation in " +"Python. Unfortunately, its development has stagnated, with its last " +"release in 2009." +msgstr "" + +#: ../../scenarios/imaging.rst:23 +msgid "" +"Luckily for you, there's an actively-developed fork of PIL called `Pillow" +" `_ -- it's easier to install, runs on " +"all major operating systems, and supports Python 3." +msgstr "" + +#: ../../scenarios/imaging.rst:28 ../../scenarios/imaging.rst:77 +msgid "Installation" +msgstr "" + +#: ../../scenarios/imaging.rst:30 +msgid "" +"Before installing Pillow, you'll have to install Pillow's prerequisites. " +"Find the instructions for your platform in the `Pillow installation " +"instructions " +"`_." +msgstr "" + +#: ../../scenarios/imaging.rst:34 +msgid "After that, it's straightforward:" +msgstr "" + +#: ../../scenarios/imaging.rst:41 ../../scenarios/imaging.rst:92 +msgid "Example" +msgstr "" + +#: ../../scenarios/imaging.rst:64 +msgid "" +"There are more examples of the Pillow library in the `Pillow tutorial " +"`_." +msgstr "" + +#: ../../scenarios/imaging.rst:70 +msgid "Open Source Computer Vision" +msgstr "" + +#: ../../scenarios/imaging.rst:72 +msgid "" +"Open Source Computer Vision, more commonly known as OpenCV, is a more " +"advanced image manipulation and processing software than PIL. It has been" +" implemented in several languages and is widely used." +msgstr "" + +#: ../../scenarios/imaging.rst:79 +msgid "" +"In Python, image processing using OpenCV is implemented using the ``cv2``" +" and ``NumPy`` modules. The `installation instructions for OpenCV " +"`_ should guide you through configuring " +"the project for yourself." +msgstr "" + +#: ../../scenarios/imaging.rst:84 +msgid "NumPy can be downloaded from the Python Package Index(PyPI):" +msgstr "" + +#: ../../scenarios/imaging.rst:110 +msgid "" +"There are more Python-implemented examples of OpenCV in this `collection " +"of tutorials `_." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/json.po b/locales/zh_CN/LC_MESSAGES/scenarios/json.po new file mode 100644 index 000000000..50bb5257c --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/json.po @@ -0,0 +1,56 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/json.rst:4 +msgid "JSON" +msgstr "" + +#: ../../scenarios/json.rst:8 +msgid "" +"The `json `_ library can " +"parse JSON from strings or files. The library parses JSON into a Python " +"dictionary or list. It can also convert Python dictionaries or lists into" +" JSON strings." +msgstr "" + +#: ../../scenarios/json.rst:15 +msgid "Parsing JSON" +msgstr "" + +#: ../../scenarios/json.rst:17 +msgid "Take the following string containing JSON data:" +msgstr "" + +#: ../../scenarios/json.rst:23 +msgid "It can be parsed like this:" +msgstr "" + +#: ../../scenarios/json.rst:30 +msgid "and can now be used as a normal dictionary:" +msgstr "" + +#: ../../scenarios/json.rst:37 +msgid "You can also convert the following to JSON:" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/ml.po b/locales/zh_CN/LC_MESSAGES/scenarios/ml.po new file mode 100644 index 000000000..5c1eab3ce --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/ml.po @@ -0,0 +1,192 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/ml.rst:5 +msgid "Machine Learning" +msgstr "" + +#: ../../scenarios/ml.rst:9 +msgid "" +"Python has a vast number of libraries for data analysis, statistics, and " +"Machine Learning itself, making it a language of choice for many data " +"scientists." +msgstr "" + +#: ../../scenarios/ml.rst:11 +msgid "" +"Some widely used packages for Machine Learning and other data science " +"applications are listed below." +msgstr "" + +#: ../../scenarios/ml.rst:16 +msgid "SciPy Stack" +msgstr "" + +#: ../../scenarios/ml.rst:18 +msgid "" +"The SciPy stack consists of a bunch of core helper packages used in data " +"science for statistical analysis and visualising data. Because of its " +"huge number of functionalities and ease of use, the Stack is considered a" +" must-have for most data science applications." +msgstr "" + +#: ../../scenarios/ml.rst:20 +msgid "" +"The Stack consists of the following packages (link to documentation " +"given):" +msgstr "" + +#: ../../scenarios/ml.rst:22 +msgid "`NumPy `_" +msgstr "" + +#: ../../scenarios/ml.rst:23 +msgid "`SciPy library `_" +msgstr "" + +#: ../../scenarios/ml.rst:24 +msgid "`Matplotlib `_" +msgstr "" + +#: ../../scenarios/ml.rst:25 +msgid "`IPython `_" +msgstr "" + +#: ../../scenarios/ml.rst:26 +msgid "`pandas `_" +msgstr "" + +#: ../../scenarios/ml.rst:27 +msgid "`Sympy `_" +msgstr "" + +#: ../../scenarios/ml.rst:28 +msgid "`nose `_" +msgstr "" + +#: ../../scenarios/ml.rst:30 +msgid "" +"The stack also comes with Python bundled in, but has been excluded from " +"the above list." +msgstr "" + +#: ../../scenarios/ml.rst:33 ../../scenarios/ml.rst:49 +msgid "Installation" +msgstr "" + +#: ../../scenarios/ml.rst:35 +msgid "" +"For installing the full stack, or individual packages, you can refer to " +"the instructions given `here `_." +msgstr "" + +#: ../../scenarios/ml.rst:37 +msgid "" +"**NB:** `Anaconda `_ is " +"highly preferred and recommended for installing and maintaining data " +"science packages seamlessly." +msgstr "" + +#: ../../scenarios/ml.rst:42 +msgid "scikit-learn" +msgstr "" + +#: ../../scenarios/ml.rst:44 +msgid "" +"Scikit is a free and open source machine learning library for Python. It " +"offers off-the-shelf functions to implement many algorithms like linear " +"regression, classifiers, SVMs, k-means, Neural Networks, etc. It also has" +" a few sample datasets which can be directly used for training and " +"testing." +msgstr "" + +#: ../../scenarios/ml.rst:46 +msgid "" +"Because of its speed, robustness, and ease of, it's one of the most " +"widely-used libraries for many Machine Learning applications." +msgstr "" + +#: ../../scenarios/ml.rst:51 +msgid "Through PyPI:" +msgstr "" + +#: ../../scenarios/ml.rst:57 +msgid "Through conda:" +msgstr "" + +#: ../../scenarios/ml.rst:63 +msgid "" +"scikit-learn also comes shipped with Anaconda (mentioned above). For more" +" installation instructions, refer to `this link `_." +msgstr "" + +#: ../../scenarios/ml.rst:66 +msgid "Example" +msgstr "" + +#: ../../scenarios/ml.rst:68 +msgid "" +"For this example, we train a simple classifier on the `Iris dataset " +"`_, which comes " +"bundled in with scikit-learn." +msgstr "" + +#: ../../scenarios/ml.rst:70 +msgid "" +"The dataset takes four features of flowers: sepal length, sepal width, " +"petal length, and petal width, and classifies them into three flower " +"species (labels): setosa, versicolor, or virginica. The labels have been " +"represented as numbers in the dataset: 0 (setosa), 1 (versicolor), and 2 " +"(virginica)." +msgstr "" + +#: ../../scenarios/ml.rst:72 +msgid "" +"We shuffle the Iris dataset and divide it into separate training and " +"testing sets, keeping the last 10 data points for testing and rest for " +"training. We then train the classifier on the training set and predict on" +" the testing set." +msgstr "" + +#: ../../scenarios/ml.rst:115 +msgid "" +"Since we're splitting randomly and the classifier trains on every " +"iteration, the accuracy may vary. Running the above code gives:" +msgstr "" + +#: ../../scenarios/ml.rst:123 +msgid "" +"The first line contains the labels (i.e. flower species) of the testing " +"data as predicted by our classifier, and the second line contains the " +"actual flower species as given in the dataset. We thus get an accuracy of" +" 100% this time." +msgstr "" + +#: ../../scenarios/ml.rst:125 +msgid "" +"More on scikit-learn can be read in the `documentation `_." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/network.po b/locales/zh_CN/LC_MESSAGES/scenarios/network.po new file mode 100644 index 000000000..edd2f0d5b --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/network.po @@ -0,0 +1,90 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/network.rst:4 +msgid "Networking" +msgstr "" + +#: ../../scenarios/network.rst:11 +msgid "Twisted" +msgstr "" + +#: ../../scenarios/network.rst:13 +msgid "" +"`Twisted `_ is an event-driven " +"networking engine. It can be used to build applications around many " +"different networking protocols, including HTTP servers and clients, " +"applications using SMTP, POP3, IMAP, or SSH protocols, instant messaging," +" and `much more `_." +msgstr "" + +#: ../../scenarios/network.rst:22 +msgid "PyZMQ" +msgstr "" + +#: ../../scenarios/network.rst:24 +msgid "" +"`PyZMQ `_ is the Python binding for " +"`ZeroMQ `_, which is a high-performance asynchronous " +"messaging library. One great advantage of ZeroMQ is that it can be used " +"for message queuing without a message broker. The basic patterns for this" +" are:" +msgstr "" + +#: ../../scenarios/network.rst:29 +msgid "" +"request-reply: connects a set of clients to a set of services. This is a " +"remote procedure call and task distribution pattern." +msgstr "" + +#: ../../scenarios/network.rst:31 +msgid "" +"publish-subscribe: connects a set of publishers to a set of subscribers. " +"This is a data distribution pattern." +msgstr "" + +#: ../../scenarios/network.rst:33 +msgid "" +"push-pull (or pipeline): connects nodes in a fan-out/fan-in pattern that " +"can have multiple steps and loops. This is a parallel task distribution " +"and collection pattern." +msgstr "" + +#: ../../scenarios/network.rst:37 +msgid "" +"For a quick start, read the `ZeroMQ guide " +"`_." +msgstr "" + +#: ../../scenarios/network.rst:42 +msgid "gevent" +msgstr "" + +#: ../../scenarios/network.rst:44 +msgid "" +"`gevent `_ is a coroutine-based Python networking" +" library that uses greenlets to provide a high-level synchronous API on " +"top of the libev event loop." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/scientific.po b/locales/zh_CN/LC_MESSAGES/scenarios/scientific.po new file mode 100644 index 000000000..23311fca6 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/scientific.po @@ -0,0 +1,248 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/scientific.rst:4 +msgid "Scientific Applications" +msgstr "" + +#: ../../scenarios/scientific.rst:11 +msgid "Context" +msgstr "" + +#: ../../scenarios/scientific.rst:13 +msgid "" +"Python is frequently used for high-performance scientific applications. " +"It is widely used in academia and scientific projects because it is easy " +"to write and performs well." +msgstr "" + +#: ../../scenarios/scientific.rst:17 +msgid "" +"Due to its high performance nature, scientific computing in Python often " +"utilizes external libraries, typically written in faster languages (like " +"C, or Fortran for matrix operations). The main libraries used are " +"`NumPy`_, `SciPy`_ and `Matplotlib`_. Going into detail about these " +"libraries is beyond the scope of the Python guide. However, a " +"comprehensive introduction to the scientific Python ecosystem can be " +"found in the `Python Scientific Lecture Notes `_." +msgstr "" + +#: ../../scenarios/scientific.rst:28 +msgid "Tools" +msgstr "" + +#: ../../scenarios/scientific.rst:31 +msgid "IPython" +msgstr "" + +#: ../../scenarios/scientific.rst:33 +msgid "" +"`IPython `_ is an enhanced version of Python " +"interpreter, which provides features of great interest to scientists. The" +" `inline mode` allows graphics and plots to be displayed in the terminal " +"(Qt based version). Moreover, the `notebook` mode supports literate " +"programming and reproducible science generating a web-based Python " +"notebook. This notebook allows you to store chunks of Python code " +"alongside the results and additional comments (HTML, LaTeX, Markdown). " +"The notebook can then be shared and exported in various file formats." +msgstr "" + +#: ../../scenarios/scientific.rst:45 +msgid "Libraries" +msgstr "" + +#: ../../scenarios/scientific.rst:48 +msgid "NumPy" +msgstr "" + +#: ../../scenarios/scientific.rst:50 +msgid "" +"`NumPy `_ is a low level library written in C " +"(and Fortran) for high level mathematical functions. NumPy cleverly " +"overcomes the problem of running slower algorithms on Python by using " +"multidimensional arrays and functions that operate on arrays. Any " +"algorithm can then be expressed as a function on arrays, allowing the " +"algorithms to be run quickly." +msgstr "" + +#: ../../scenarios/scientific.rst:56 +msgid "" +"NumPy is part of the SciPy project, and is released as a separate library" +" so people who only need the basic requirements can use it without " +"installing the rest of SciPy." +msgstr "" + +#: ../../scenarios/scientific.rst:60 +msgid "NumPy is compatible with Python versions 2.4 through 2.7.2 and 3.1+." +msgstr "" + +#: ../../scenarios/scientific.rst:63 +msgid "Numba" +msgstr "" + +#: ../../scenarios/scientific.rst:65 +msgid "" +"`Numba `_ is a NumPy aware Python compiler " +"(just-in-time (JIT) specializing compiler) which compiles annotated " +"Python (and NumPy) code to LLVM (Low Level Virtual Machine) through " +"special decorators. Briefly, Numba uses a system that compiles Python " +"code with LLVM to code which can be natively executed at runtime." +msgstr "" + +#: ../../scenarios/scientific.rst:72 +msgid "SciPy" +msgstr "" + +#: ../../scenarios/scientific.rst:74 +msgid "" +"`SciPy `_ is a library that uses NumPy for more " +"mathematical functions. SciPy uses NumPy arrays as the basic data " +"structure, and comes with modules for various commonly used tasks in " +"scientific programming, including linear algebra, integration (calculus)," +" ordinary differential equation solving, and signal processing." +msgstr "" + +#: ../../scenarios/scientific.rst:81 +msgid "Matplotlib" +msgstr "" + +#: ../../scenarios/scientific.rst:83 +msgid "" +"`Matplotlib `_ is a flexible plotting" +" library for creating interactive 2D and 3D plots that can also be saved " +"as manuscript-quality figures. The API in many ways reflects that of " +"`MATLAB `_, easing transition " +"of MATLAB users to Python. Many examples, along with the source code to " +"recreate them, are available in the `matplotlib gallery " +"`_." +msgstr "" + +#: ../../scenarios/scientific.rst:92 +msgid "Pandas" +msgstr "" + +#: ../../scenarios/scientific.rst:94 +msgid "" +"`Pandas `_ is a data manipulation library " +"based on NumPy which provides many useful functions for accessing, " +"indexing, merging, and grouping data easily. The main data structure " +"(DataFrame) is close to what could be found in the R statistical package;" +" that is, heterogeneous data tables with name indexing, time series " +"operations, and auto-alignment of data." +msgstr "" + +#: ../../scenarios/scientific.rst:102 +msgid "xarray" +msgstr "" + +#: ../../scenarios/scientific.rst:104 +msgid "" +"`xarray `_ is similar to Pandas, but" +" it is intended for wrapping multidimensional scientific data. By " +"labelling the data with dimensions, coordinates, and attributes, it makes" +" complex multidimensional operations clearer and more intuitive. It also " +"wraps matplotlib for quick plotting, and can apply most operations in " +"parallel using `dask `_." +msgstr "" + +#: ../../scenarios/scientific.rst:113 +msgid "Rpy2" +msgstr "" + +#: ../../scenarios/scientific.rst:115 +msgid "" +"`Rpy2 `_ is a Python binding for the R " +"statistical package allowing the execution of R functions from Python and" +" passing data back and forth between the two environments. Rpy2 is the " +"object oriented implementation of the `Rpy " +"`_ bindings." +msgstr "" + +#: ../../scenarios/scientific.rst:122 +msgid "PsychoPy" +msgstr "" + +#: ../../scenarios/scientific.rst:124 +msgid "" +"`PsychoPy `_ is a library for cognitive " +"scientists allowing the creation of cognitive psychology and neuroscience" +" experiments. The library handles presentation of stimuli, scripting of " +"experimental design, and data collection." +msgstr "" + +#: ../../scenarios/scientific.rst:132 +msgid "Resources" +msgstr "" + +#: ../../scenarios/scientific.rst:134 +msgid "" +"Installation of scientific Python packages can be troublesome, as many of" +" these packages are implemented as Python C extensions which need to be " +"compiled. This section lists various so-called scientific Python " +"distributions which provide precompiled and easy-to-install collections " +"of scientific Python packages." +msgstr "" + +#: ../../scenarios/scientific.rst:141 +msgid "Unofficial Windows Binaries for Python Extension Packages" +msgstr "" + +#: ../../scenarios/scientific.rst:143 +msgid "" +"Many people who do scientific computing are on Windows, yet many of the " +"scientific computing packages are notoriously difficult to build and " +"install on this platform. `Christoph Gohlke " +"`_, however, has compiled a " +"list of Windows binaries for many useful Python packages. The list of " +"packages has grown from a mainly scientific Python resource to a more " +"general list. If you're on Windows, you may want to check it out." +msgstr "" + +#: ../../scenarios/scientific.rst:152 +msgid "Anaconda" +msgstr "" + +#: ../../scenarios/scientific.rst:154 +msgid "" +"The `Anaconda Python Distribution `_ includes " +"all the common scientific Python packages as well as many packages " +"related to data analytics and big data. Anaconda itself is free, and a " +"number of proprietary add-ons are available for a fee. Free licenses for " +"the add-ons are available for academics and researchers." +msgstr "" + +#: ../../scenarios/scientific.rst:161 +msgid "Canopy" +msgstr "" + +#: ../../scenarios/scientific.rst:163 +msgid "" +"`Canopy `_ is another " +"scientific Python distribution, produced by `Enthought " +"`_. A limited 'Canopy Express' variant is " +"available for free, but Enthought charges for the full distribution. Free" +" licenses are available for academics." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/scrape.po b/locales/zh_CN/LC_MESSAGES/scenarios/scrape.po new file mode 100644 index 000000000..5fc01cc08 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/scrape.po @@ -0,0 +1,132 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/scrape.rst:4 +msgid "HTML Scraping" +msgstr "" + +#: ../../scenarios/scrape.rst:11 +msgid "Web Scraping" +msgstr "" + +#: ../../scenarios/scrape.rst:13 +msgid "" +"Web sites are written using HTML, which means that each web page is a " +"structured document. Sometimes it would be great to obtain some data from" +" them and preserve the structure while we're at it. Web sites don't " +"always provide their data in comfortable formats such as CSV or JSON." +msgstr "" + +#: ../../scenarios/scrape.rst:18 +msgid "" +"This is where web scraping comes in. Web scraping is the practice of " +"using a computer program to sift through a web page and gather the data " +"that you need in a format most useful to you while at the same time " +"preserving the structure of the data." +msgstr "" + +#: ../../scenarios/scrape.rst:26 +msgid "lxml and Requests" +msgstr "" + +#: ../../scenarios/scrape.rst:28 +msgid "" +"`lxml `_ is a pretty extensive library written for " +"parsing XML and HTML documents very quickly, even handling messed up tags" +" in the process. We will also be using the `Requests `_ module instead of the already built-in urllib2" +" module due to improvements in speed and readability. You can easily " +"install both using ``pip install lxml`` and ``pip install requests``." +msgstr "" + +#: ../../scenarios/scrape.rst:36 +msgid "Let's start with the imports:" +msgstr "" + +#: ../../scenarios/scrape.rst:43 +msgid "" +"Next we will use ``requests.get`` to retrieve the web page with our data," +" parse it using the ``html`` module, and save the results in ``tree``:" +msgstr "" + +#: ../../scenarios/scrape.rst:51 +msgid "" +"(We need to use ``page.content`` rather than ``page.text`` because " +"``html.fromstring`` implicitly expects ``bytes`` as input.)" +msgstr "" + +#: ../../scenarios/scrape.rst:54 +msgid "" +"``tree`` now contains the whole HTML file in a nice tree structure which " +"we can go over two different ways: XPath and CSSSelect. In this example, " +"we will focus on the former." +msgstr "" + +#: ../../scenarios/scrape.rst:58 +msgid "" +"XPath is a way of locating information in structured documents such as " +"HTML or XML documents. A good introduction to XPath is on `W3Schools " +"`_ ." +msgstr "" + +#: ../../scenarios/scrape.rst:62 +msgid "" +"There are also various tools for obtaining the XPath of elements such as " +"FireBug for Firefox or the Chrome Inspector. If you're using Chrome, you " +"can right click an element, choose 'Inspect element', highlight the code," +" right click again, and choose 'Copy XPath'." +msgstr "" + +#: ../../scenarios/scrape.rst:67 +msgid "" +"After a quick analysis, we see that in our page the data is contained in " +"two elements -- one is a div with title 'buyer-name' and the other is a " +"span with class 'item-price':" +msgstr "" + +#: ../../scenarios/scrape.rst:76 +msgid "" +"Knowing this we can create the correct XPath query and use the lxml " +"``xpath`` function like this:" +msgstr "" + +#: ../../scenarios/scrape.rst:86 +msgid "Let's see what we got exactly:" +msgstr "" + +#: ../../scenarios/scrape.rst:106 +msgid "" +"Congratulations! We have successfully scraped all the data we wanted from" +" a web page using lxml and Requests. We have it stored in memory as two " +"lists. Now we can do all sorts of cool stuff with it: we can analyze it " +"using Python or we can save it to a file and share it with the world." +msgstr "" + +#: ../../scenarios/scrape.rst:111 +msgid "" +"Some more cool ideas to think about are modifying this script to iterate " +"through the rest of the pages of this example dataset, or rewriting this " +"application to use threads for improved speed." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/serialization.po b/locales/zh_CN/LC_MESSAGES/scenarios/serialization.po new file mode 100644 index 000000000..6a49aeb2c --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/serialization.po @@ -0,0 +1,223 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/serialization.rst:4 +msgid "Data Serialization" +msgstr "" + +#: ../../scenarios/serialization.rst:11 +msgid "What is data serialization?" +msgstr "" + +#: ../../scenarios/serialization.rst:13 +msgid "" +"Data serialization is the process of converting structured data to a " +"format that allows sharing or storage of the data in a form that allows " +"recovery of its original structure. In some cases, the secondary " +"intention of data serialization is to minimize the data's size which then" +" reduces disk space or bandwidth requirements." +msgstr "" + +#: ../../scenarios/serialization.rst:21 +msgid "Flat vs. Nested data" +msgstr "" + +#: ../../scenarios/serialization.rst:23 +msgid "" +"Before beginning to serialize data, it is important to identify or decide" +" how the data should be structured during data serialization - flat or " +"nested. The differences in the two styles are shown in the below " +"examples." +msgstr "" + +#: ../../scenarios/serialization.rst:27 +msgid "Flat style:" +msgstr "" + +#: ../../scenarios/serialization.rst:34 +msgid "Nested style:" +msgstr "" + +#: ../../scenarios/serialization.rst:42 +msgid "" +"For more reading on the two styles, please see the discussion on `Python " +"mailing list `__, `IETF mailing list " +"`__ and" +" `in stackexchange " +"`__." +msgstr "" + +#: ../../scenarios/serialization.rst:49 +msgid "Serializing Text" +msgstr "" + +#: ../../scenarios/serialization.rst:53 +msgid "Simple file (flat data)" +msgstr "" + +#: ../../scenarios/serialization.rst:55 +msgid "" +"If the data to be serialized is located in a file and contains flat data," +" Python offers two methods to serialize data." +msgstr "" + +#: ../../scenarios/serialization.rst:58 +msgid "repr" +msgstr "" + +#: ../../scenarios/serialization.rst:60 +msgid "" +"The repr method in Python takes a single object parameter and returns a " +"printable representation of the input:" +msgstr "" + +#: ../../scenarios/serialization.rst:79 +msgid "ast.literal_eval" +msgstr "" + +#: ../../scenarios/serialization.rst:81 +msgid "" +"The literal_eval method safely parses and evaluates an expression for a " +"Python datatype. Supported data types are: strings, numbers, tuples, " +"lists, dicts, booleans, and None." +msgstr "" + +#: ../../scenarios/serialization.rst:90 +msgid "CSV file (flat data)" +msgstr "" + +#: ../../scenarios/serialization.rst:92 +msgid "" +"The CSV module in Python implements classes to read and write tabular " +"data in CSV format." +msgstr "" + +#: ../../scenarios/serialization.rst:95 +msgid "Simple example for reading:" +msgstr "" + +#: ../../scenarios/serialization.rst:106 +msgid "Simple example for writing:" +msgstr "" + +#: ../../scenarios/serialization.rst:117 +msgid "" +"The module's contents, functions, and examples can be found `in the " +"Python documentation `__." +msgstr "" + +#: ../../scenarios/serialization.rst:122 +msgid "YAML (nested data)" +msgstr "" + +#: ../../scenarios/serialization.rst:124 +msgid "" +"There are many third party modules to parse and read/write YAML file " +"structures in Python. One such example is below." +msgstr "" + +#: ../../scenarios/serialization.rst:137 +msgid "" +"Documentation on the third party module can be found `in the PyYAML " +"Documentation `__." +msgstr "" + +#: ../../scenarios/serialization.rst:142 +msgid "JSON file (nested data)" +msgstr "" + +#: ../../scenarios/serialization.rst:144 +msgid "" +"Python's JSON module can be used to read and write JSON files. Example " +"code is below." +msgstr "" + +#: ../../scenarios/serialization.rst:147 +msgid "Reading:" +msgstr "" + +#: ../../scenarios/serialization.rst:156 +msgid "Writing:" +msgstr "" + +#: ../../scenarios/serialization.rst:167 +msgid "XML (nested data)" +msgstr "" + +#: ../../scenarios/serialization.rst:169 +msgid "XML parsing in Python is possible using the `xml` package." +msgstr "" + +#: ../../scenarios/serialization.rst:171 ../../scenarios/serialization.rst:194 +msgid "Example:" +msgstr "" + +#: ../../scenarios/serialization.rst:180 +msgid "" +"More documentation on using the `xml.dom` and `xml.sax` packages can be " +"found `in the Python XML library documentation " +"`__." +msgstr "" + +#: ../../scenarios/serialization.rst:186 +msgid "Binary" +msgstr "" + +#: ../../scenarios/serialization.rst:190 +msgid "NumPy Array (flat data)" +msgstr "" + +#: ../../scenarios/serialization.rst:192 +msgid "" +"Python's NumPy array can be used to serialize and deserialize data to and" +" from byte representation." +msgstr "" + +#: ../../scenarios/serialization.rst:210 +msgid "Pickle (nested data)" +msgstr "" + +#: ../../scenarios/serialization.rst:212 +msgid "" +"The native data serialization module for Python is called `Pickle " +"`_." +msgstr "" + +#: ../../scenarios/serialization.rst:215 +msgid "Here's an example:" +msgstr "" + +#: ../../scenarios/serialization.rst:233 +msgid "Protobuf" +msgstr "" + +#: ../../scenarios/serialization.rst:235 +msgid "" +"If you're looking for a serialization module that has support in multiple" +" languages, Google's `Protobuf `_ library is an option." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/speed.po b/locales/zh_CN/LC_MESSAGES/scenarios/speed.po new file mode 100644 index 000000000..2136b404a --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/speed.po @@ -0,0 +1,362 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/speed.rst:4 +msgid "Speed" +msgstr "" + +#: ../../scenarios/speed.rst:8 +msgid "" +"CPython, the most commonly used implementation of Python, is slow for CPU" +" bound tasks. `PyPy`_ is fast." +msgstr "" + +#: ../../scenarios/speed.rst:11 +msgid "" +"Using a slightly modified version of `David Beazley's`_ CPU bound test " +"code (added loop for multiple tests), you can see the difference between " +"CPython and PyPy's processing." +msgstr "" + +#: ../../scenarios/speed.rst:43 +msgid "Context" +msgstr "" + +#: ../../scenarios/speed.rst:47 ../../scenarios/speed.rst:65 +msgid "The GIL" +msgstr "" + +#: ../../scenarios/speed.rst:49 +msgid "" +"`The GIL`_ (Global Interpreter Lock) is how Python allows multiple " +"threads to operate at the same time. Python's memory management isn't " +"entirely thread-safe, so the GIL is required to prevent multiple threads " +"from running the same Python code at once." +msgstr "" + +#: ../../scenarios/speed.rst:54 +msgid "" +"David Beazley has a great `guide`_ on how the GIL operates. He also " +"covers the `new GIL`_ in Python 3.2. His results show that maximizing " +"performance in a Python application requires a strong understanding of " +"the GIL, how it affects your specific application, how many cores you " +"have, and where your application bottlenecks are." +msgstr "" + +#: ../../scenarios/speed.rst:61 ../../scenarios/speed.rst:73 +msgid "C Extensions" +msgstr "" + +#: ../../scenarios/speed.rst:67 +msgid "" +"`Special care`_ must be taken when writing C extensions to make sure you " +"register your threads with the interpreter." +msgstr "" + +#: ../../scenarios/speed.rst:77 +msgid "Cython" +msgstr "" + +#: ../../scenarios/speed.rst:79 +msgid "" +"`Cython `_ implements a superset of the Python " +"language with which you are able to write C and C++ modules for Python. " +"Cython also allows you to call functions from compiled C libraries. Using" +" Cython allows you to take advantage of Python's strong typing of " +"variables and operations." +msgstr "" + +#: ../../scenarios/speed.rst:84 +msgid "Here's an example of strong typing with Cython:" +msgstr "" + +#: ../../scenarios/speed.rst:111 +msgid "" +"This implementation of an algorithm to find prime numbers has some " +"additional keywords compared to the next one, which is implemented in " +"pure Python:" +msgstr "" + +#: ../../scenarios/speed.rst:136 +msgid "" +"Notice that in the Cython version you declare integers and integer arrays" +" to be compiled into C types while also creating a Python list:" +msgstr "" + +#: ../../scenarios/speed.rst:159 +msgid "" +"What is the difference? In the upper Cython version you can see the " +"declaration of the variable types and the integer array in a similar way " +"as in standard C. For example `cdef int n,k,i` in line 3. This additional" +" type declaration (i.e. integer) allows the Cython compiler to generate " +"more efficient C code from the second version. While standard Python code" +" is saved in :file:`*.py` files, Cython code is saved in :file:`*.pyx` " +"files." +msgstr "" + +#: ../../scenarios/speed.rst:166 +msgid "What's the difference in speed? Let's try it!" +msgstr "" + +#: ../../scenarios/speed.rst:190 +msgid "These lines both need a remark:" +msgstr "" + +#: ../../scenarios/speed.rst:198 +msgid "" +"The `pyximport` module allows you to import :file:`*.pyx` files (e.g., " +":file:`primesCy.pyx`) with the Cython-compiled version of the `primes` " +"function. The `pyximport.install()` command allows the Python interpreter" +" to start the Cython compiler directly to generate C code, which is " +"automatically compiled to a :file:`*.so` C library. Cython is then able " +"to import this library for you in your Python code, easily and " +"efficiently. With the `time.time()` function you are able to compare the " +"time between these 2 different calls to find 500 prime numbers. On a " +"standard notebook (dual core AMD E-450 1.6 GHz), the measured values are:" +msgstr "" + +#: ../../scenarios/speed.rst:215 +msgid "" +"And here is the output of an embedded `ARM beaglebone " +"`_ machine:" +msgstr "" + +#: ../../scenarios/speed.rst:225 +msgid "Pyrex" +msgstr "" + +#: ../../scenarios/speed.rst:229 +msgid "Shedskin?" +msgstr "" + +#: ../../scenarios/speed.rst:234 +msgid "Concurrency" +msgstr "" + +#: ../../scenarios/speed.rst:238 +msgid "Concurrent.futures" +msgstr "" + +#: ../../scenarios/speed.rst:240 +msgid "" +"The `concurrent.futures`_ module is a module in the standard library that" +" provides a \"high-level interface for asynchronously executing " +"callables\". It abstracts away a lot of the more complicated details " +"about using multiple threads or processes for concurrency, and allows the" +" user to focus on accomplishing the task at hand." +msgstr "" + +#: ../../scenarios/speed.rst:246 +msgid "" +"The `concurrent.futures`_ module exposes two main classes, the " +"`ThreadPoolExecutor` and the `ProcessPoolExecutor`. The " +"ThreadPoolExecutor will create a pool of worker threads that a user can " +"submit jobs to. These jobs will then be executed in another thread when " +"the next worker thread becomes available." +msgstr "" + +#: ../../scenarios/speed.rst:252 +msgid "" +"The ProcessPoolExecutor works in the same way, except instead of using " +"multiple threads for its workers, it will use multiple processes. This " +"makes it possible to side-step the GIL; however, because of the way " +"things are passed to worker processes, only picklable objects can be " +"executed and returned." +msgstr "" + +#: ../../scenarios/speed.rst:257 +msgid "" +"Because of the way the GIL works, a good rule of thumb is to use a " +"ThreadPoolExecutor when the task being executed involves a lot of " +"blocking (i.e. making requests over the network) and to use a " +"ProcessPoolExecutor executor when the task is computationally expensive." +msgstr "" + +#: ../../scenarios/speed.rst:262 +msgid "" +"There are two main ways of executing things in parallel using the two " +"Executors. One way is with the `map(func, iterables)` method. This works " +"almost exactly like the builtin `map()` function, except it will execute " +"everything in parallel." +msgstr "" + +#: ../../scenarios/speed.rst:284 +msgid "" +"For even more control, the `submit(func, *args, **kwargs)` method will " +"schedule a callable to be executed ( as `func(*args, **kwargs)`) and " +"returns a `Future`_ object that represents the execution of the callable." +msgstr "" + +#: ../../scenarios/speed.rst:288 +msgid "" +"The Future object provides various methods that can be used to check on " +"the progress of the scheduled callable. These include:" +msgstr "" + +#: ../../scenarios/speed.rst:291 +msgid "cancel()" +msgstr "" + +#: ../../scenarios/speed.rst:292 +msgid "Attempt to cancel the call." +msgstr "" + +#: ../../scenarios/speed.rst:293 +msgid "cancelled()" +msgstr "" + +#: ../../scenarios/speed.rst:294 +msgid "Return True if the call was successfully cancelled." +msgstr "" + +#: ../../scenarios/speed.rst:296 +msgid "running()" +msgstr "" + +#: ../../scenarios/speed.rst:296 +msgid "" +"Return True if the call is currently being executed and cannot be " +"cancelled." +msgstr "" + +#: ../../scenarios/speed.rst:298 +msgid "done()" +msgstr "" + +#: ../../scenarios/speed.rst:299 +msgid "Return True if the call was successfully cancelled or finished running." +msgstr "" + +#: ../../scenarios/speed.rst:301 +msgid "result()" +msgstr "" + +#: ../../scenarios/speed.rst:301 +msgid "" +"Return the value returned by the call. Note that this call will block " +"until the scheduled callable returns by default." +msgstr "" + +#: ../../scenarios/speed.rst:304 +msgid "exception()" +msgstr "" + +#: ../../scenarios/speed.rst:304 +msgid "" +"Return the exception raised by the call. If no exception was raised then " +"this returns None. Note that this will block just like `result()`." +msgstr "" + +#: ../../scenarios/speed.rst:309 +msgid "add_done_callback(fn)" +msgstr "" + +#: ../../scenarios/speed.rst:307 +msgid "" +"Attach a callback function that will be executed (as `fn(future)`) when " +"the scheduled callable returns." +msgstr "" + +#: ../../scenarios/speed.rst:348 +msgid "" +"The `concurrent.futures`_ module contains two helper functions for " +"working with Futures. The `as_completed(futures)` function returns an " +"iterator over the list of futures, yielding the futures as they complete." +msgstr "" + +#: ../../scenarios/speed.rst:352 +msgid "" +"The `wait(futures)` function will simply block until all futures in the " +"list of futures provided have completed." +msgstr "" + +#: ../../scenarios/speed.rst:355 +msgid "" +"For more information, on using the `concurrent.futures`_ module, consult " +"the official documentation." +msgstr "" + +#: ../../scenarios/speed.rst:359 +msgid "threading" +msgstr "" + +#: ../../scenarios/speed.rst:361 +msgid "" +"The standard library comes with a `threading`_ module that allows a user " +"to work with multiple threads manually." +msgstr "" + +#: ../../scenarios/speed.rst:364 +msgid "" +"Running a function in another thread is as simple as passing a callable " +"and its arguments to `Thread`'s constructor and then calling `start()`:" +msgstr "" + +#: ../../scenarios/speed.rst:379 +msgid "To wait until the thread has terminated, call `join()`:" +msgstr "" + +#: ../../scenarios/speed.rst:385 +msgid "" +"After calling `join()`, it is always a good idea to check whether the " +"thread is still alive (because the join call timed out):" +msgstr "" + +#: ../../scenarios/speed.rst:395 +msgid "" +"Because multiple threads have access to the same section of memory, " +"sometimes there might be situations where two or more threads are trying " +"to write to the same resource at the same time or where the output is " +"dependent on the sequence or timing of certain events. This is called a " +"`data race`_ or race condition. When this happens, the output will be " +"garbled or you may encounter problems which are difficult to debug. A " +"good example is this `Stack Overflow post`_." +msgstr "" + +#: ../../scenarios/speed.rst:402 +msgid "" +"The way this can be avoided is by using a `Lock`_ that each thread needs " +"to acquire before writing to a shared resource. Locks can be acquired and" +" released through either the contextmanager protocol (`with` statement), " +"or by using `acquire()` and `release()` directly. Here is a (rather " +"contrived) example:" +msgstr "" + +#: ../../scenarios/speed.rst:434 +msgid "" +"Here, we have a bunch of threads checking for changes on a list of sites " +"and whenever there are any changes, they attempt to write those changes " +"to a file by calling `log(changes)`. When `log()` is called, it will wait" +" to acquire the lock with `with file_lock:`. This ensures that at any one" +" time, only one thread is writing to the file." +msgstr "" + +#: ../../scenarios/speed.rst:441 +msgid "Spawning Processes" +msgstr "" + +#: ../../scenarios/speed.rst:445 +msgid "Multiprocessing" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/web.po b/locales/zh_CN/LC_MESSAGES/scenarios/web.po new file mode 100644 index 000000000..7f42afa08 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/web.po @@ -0,0 +1,658 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/web.rst:4 +msgid "Web Applications & Frameworks" +msgstr "" + +#: ../../scenarios/web.rst:8 +msgid "" +"As a powerful scripting language adapted to both fast prototyping and " +"bigger projects, Python is widely used in web application development." +msgstr "" + +#: ../../scenarios/web.rst:15 +msgid "Context" +msgstr "" + +#: ../../scenarios/web.rst:20 +msgid "WSGI" +msgstr "" + +#: ../../scenarios/web.rst:22 +msgid "" +"The Web Server Gateway Interface (or \"WSGI\" for short) is a standard " +"interface between web servers and Python web application frameworks. By " +"standardizing behavior and communication between web servers and Python " +"web frameworks, WSGI makes it possible to write portable Python web code " +"that can be deployed in any :ref:`WSGI-compliant web server `. WSGI is documented in :pep:`3333`." +msgstr "" + +#: ../../scenarios/web.rst:32 +msgid "Frameworks" +msgstr "" + +#: ../../scenarios/web.rst:34 +msgid "" +"Broadly speaking, a web framework consists of a set of libraries and a " +"main handler within which you can build custom code to implement a web " +"application (i.e. an interactive web site). Most web frameworks include " +"patterns and utilities to accomplish at least the following:" +msgstr "" + +#: ../../scenarios/web.rst:41 +msgid "URL Routing" +msgstr "" + +#: ../../scenarios/web.rst:40 +msgid "" +"Matches an incoming HTTP request to a particular piece of Python code to " +"be invoked" +msgstr "" + +#: ../../scenarios/web.rst:44 +msgid "Request and Response Objects" +msgstr "" + +#: ../../scenarios/web.rst:44 +msgid "Encapsulates the information received from or sent to a user's browser" +msgstr "" + +#: ../../scenarios/web.rst:48 +msgid "Template Engine" +msgstr "" + +#: ../../scenarios/web.rst:47 +msgid "" +"Allows for separating Python code implementing an application's logic " +"from the HTML (or other) output that it produces" +msgstr "" + +#: ../../scenarios/web.rst:53 +msgid "Development Web Server" +msgstr "" + +#: ../../scenarios/web.rst:51 +msgid "" +"Runs an HTTP server on development machines to enable rapid development; " +"often automatically reloads server-side code when files are updated" +msgstr "" + +#: ../../scenarios/web.rst:56 +msgid "Django" +msgstr "" + +#: ../../scenarios/web.rst:58 +msgid "" +"`Django `_ is a \"batteries included\" web" +" application framework, and is an excellent choice for creating content-" +"oriented websites. By providing many utilities and patterns out of the " +"box, Django aims to make it possible to build complex, database-backed " +"web applications quickly, while encouraging best practices in code " +"written using it." +msgstr "" + +#: ../../scenarios/web.rst:64 +msgid "" +"Django has a large and active community, and many pre-built `re-usable " +"modules `_ that can be incorporated into a " +"new project as-is, or customized to fit your needs." +msgstr "" + +#: ../../scenarios/web.rst:68 +msgid "" +"There are annual Django conferences `in the United States " +"`_, `Europe `_, and `Australia " +"`_." +msgstr "" + +#: ../../scenarios/web.rst:71 +msgid "The majority of new Python web applications today are built with Django." +msgstr "" + +#: ../../scenarios/web.rst:74 +msgid "Flask" +msgstr "" + +#: ../../scenarios/web.rst:76 +msgid "" +"`Flask `_ is a \"microframework\" for Python, " +"and is an excellent choice for building smaller applications, APIs, and " +"web services." +msgstr "" + +#: ../../scenarios/web.rst:79 +msgid "" +"Building an app with Flask is a lot like writing standard Python modules," +" except some functions have routes attached to them. It's really " +"beautiful." +msgstr "" + +#: ../../scenarios/web.rst:82 +msgid "" +"Rather than aiming to provide everything you could possibly need, Flask " +"implements the most commonly-used core components of a web application " +"framework, like URL routing, request and response objects, and templates." +msgstr "" + +#: ../../scenarios/web.rst:86 +msgid "" +"If you use Flask, it is up to you to choose other components for your " +"application, if any. For example, database access or form generation and " +"validation are not built-in functions of Flask." +msgstr "" + +#: ../../scenarios/web.rst:90 +msgid "" +"This is great, because many web applications don't need those features. " +"For those that do, there are many `Extensions " +"`_ available that may suit your " +"needs. Or, you can easily use any library you want yourself!" +msgstr "" + +#: ../../scenarios/web.rst:95 +msgid "" +"Flask is default choice for any Python web application that isn't a good " +"fit for Django." +msgstr "" + +#: ../../scenarios/web.rst:99 +msgid "Falcon" +msgstr "" + +#: ../../scenarios/web.rst:101 +msgid "" +"`Falcon `_ is a good choice when your goal " +"is to build RESTful API microservices that are fast and scalable." +msgstr "" + +#: ../../scenarios/web.rst:104 +msgid "" +"It is a reliable, high-performance Python web framework for building " +"large-scale app backends and microservices. Falcon encourages the REST " +"architectural style of mapping URIs to resources, trying to do as little " +"as possible while remaining highly effective." +msgstr "" + +#: ../../scenarios/web.rst:108 +msgid "" +"Falcon highlights four main focuses: speed, reliability, flexibility, and" +" debuggability. It implements HTTP through \"responders\" such as " +"``on_get()``, ``on_put()``, etc. These responders receive intuitive " +"request and response objects." +msgstr "" + +#: ../../scenarios/web.rst:113 +msgid "Tornado" +msgstr "" + +#: ../../scenarios/web.rst:115 +msgid "" +"`Tornado `_ is an asynchronous web framework " +"for Python that has its own event loop. This allows it to natively " +"support WebSockets, for example. Well-written Tornado applications are " +"known to have excellent performance characteristics." +msgstr "" + +#: ../../scenarios/web.rst:120 +msgid "I do not recommend using Tornado unless you think you need it." +msgstr "" + +#: ../../scenarios/web.rst:123 +msgid "Pyramid" +msgstr "" + +#: ../../scenarios/web.rst:125 +msgid "" +"`Pyramid `_ is a very flexible framework with a " +"heavy focus on modularity. It comes with a small number of libraries " +"(\"batteries\") built-in, and encourages users to extend its base " +"functionality. A set of provided cookiecutter templates helps making new " +"project decisions for users. It powers one of the most important parts of" +" python infrastructure `PyPI `_." +msgstr "" + +#: ../../scenarios/web.rst:132 +msgid "" +"Pyramid does not have a large user base, unlike Django and Flask. It's a " +"capable framework, but not a very popular choice for new Python web " +"applications today." +msgstr "" + +#: ../../scenarios/web.rst:137 +msgid "Masonite" +msgstr "" + +#: ../../scenarios/web.rst:139 +msgid "" +"`Masonite `_ is a modern and developer " +"centric, \"batteries included\", web framework." +msgstr "" + +#: ../../scenarios/web.rst:141 +msgid "" +"The Masonite framework follows the MVC (Model-View-Controller) " +"architecture pattern and is heavily inspired by frameworks such as Rails " +"and Laravel, so if you are coming to Python from a Ruby or PHP background" +" then you will feel right at home!" +msgstr "" + +#: ../../scenarios/web.rst:143 +msgid "" +"Masonite comes with a lot of functionality out of the box including a " +"powerful IOC container with auto resolving dependency injection, craft " +"command line tools, and the Orator active record style ORM." +msgstr "" + +#: ../../scenarios/web.rst:145 +msgid "" +"Masonite is perfect for beginners or experienced developers alike and " +"works hard to be fast and easy from install through to deployment. Try it" +" once and you’ll fall in love." +msgstr "" + +#: ../../scenarios/web.rst:148 +msgid "FastAPI" +msgstr "" + +#: ../../scenarios/web.rst:150 +msgid "" +"`FastAPI `_ is a modern web framework for " +"building APIs with Python 3.6+." +msgstr "" + +#: ../../scenarios/web.rst:153 +msgid "" +"It has very high performance as it is based on `Starlette " +"`_ and `Pydantic `_." +msgstr "" + +#: ../../scenarios/web.rst:156 +msgid "" +"FastAPI takes advantage of standard Python type declarations in function " +"parameters to declare request parameters and bodies, perform data " +"conversion (serialization, parsing), data validation, and automatic API " +"documentation with **OpenAPI 3** (including **JSON Schema**)." +msgstr "" + +#: ../../scenarios/web.rst:161 +msgid "" +"It includes tools and utilities for security and authentication " +"(including OAuth2 with JWT tokens), a dependency injection system, " +"automatic generation of interactive API documentation, and other " +"features." +msgstr "" + +#: ../../scenarios/web.rst:168 +msgid "Web Servers" +msgstr "" + +#: ../../scenarios/web.rst:173 +msgid "Nginx" +msgstr "" + +#: ../../scenarios/web.rst:175 +msgid "" +"`Nginx `_ (pronounced \"engine-x\") is a web server " +"and reverse-proxy for HTTP, SMTP, and other protocols. It is known for " +"its high performance, relative simplicity, and compatibility with many " +"application servers (like WSGI servers). It also includes handy features " +"like load-balancing, basic authentication, streaming, and others. " +"Designed to serve high-load websites, Nginx is gradually becoming quite " +"popular." +msgstr "" + +#: ../../scenarios/web.rst:188 +msgid "WSGI Servers" +msgstr "" + +#: ../../scenarios/web.rst:190 +msgid "" +"Stand-alone WSGI servers typically use less resources than traditional " +"web servers and provide top performance [1]_." +msgstr "" + +#: ../../scenarios/web.rst:196 +msgid "Gunicorn" +msgstr "" + +#: ../../scenarios/web.rst:198 +msgid "" +"`Gunicorn `_ (Green Unicorn) is a pure-Python WSGI" +" server used to serve Python applications. Unlike other Python web " +"servers, it has a thoughtful user interface, and is extremely easy to use" +" and configure." +msgstr "" + +#: ../../scenarios/web.rst:203 +msgid "" +"Gunicorn has sane and reasonable defaults for configurations. However, " +"some other servers, like uWSGI, are tremendously more customizable, and " +"therefore, are much more difficult to effectively use." +msgstr "" + +#: ../../scenarios/web.rst:207 +msgid "Gunicorn is the recommended choice for new Python web applications today." +msgstr "" + +#: ../../scenarios/web.rst:211 +msgid "Waitress" +msgstr "" + +#: ../../scenarios/web.rst:213 +msgid "" +"`Waitress `_ is a pure-Python WSGI " +"server that claims \"very acceptable performance\". Its documentation is " +"not very detailed, but it does offer some nice functionality that " +"Gunicorn doesn't have (e.g. HTTP request buffering)." +msgstr "" + +#: ../../scenarios/web.rst:218 +msgid "" +"Waitress is gaining popularity within the Python web development " +"community." +msgstr "" + +#: ../../scenarios/web.rst:223 +msgid "uWSGI" +msgstr "" + +#: ../../scenarios/web.rst:225 +msgid "" +"`uWSGI `_ is a full stack for building" +" hosting services. In addition to process management, process " +"monitoring, and other functionality, uWSGI acts as an application server " +"for various programming languages and protocols -- including Python and " +"WSGI. uWSGI can either be run as a stand-alone web router, or be run " +"behind a full web server (such as Nginx or Apache). In the latter case, " +"a web server can configure uWSGI and an application's operation over the " +"`uwsgi protocol `_. uWSGI's web server " +"support allows for dynamically configuring Python, passing environment " +"variables, and further tuning. For full details, see `uWSGI magic " +"variables `_." +msgstr "" + +#: ../../scenarios/web.rst:238 +msgid "I do not recommend using uWSGI unless you know why you need it." +msgstr "" + +#: ../../scenarios/web.rst:245 +msgid "Server Best Practices" +msgstr "" + +#: ../../scenarios/web.rst:247 +msgid "" +"The majority of self-hosted Python applications today are hosted with a " +"WSGI server such as :ref:`Gunicorn `, either directly or " +"behind a lightweight web server such as :ref:`nginx `." +msgstr "" + +#: ../../scenarios/web.rst:251 +msgid "" +"The WSGI servers serve the Python applications while the web server " +"handles tasks better suited for it such as static file serving, request " +"routing, DDoS protection, and basic authentication." +msgstr "" + +#: ../../scenarios/web.rst:258 +msgid "Hosting" +msgstr "" + +#: ../../scenarios/web.rst:260 +msgid "" +"Platform-as-a-Service (PaaS) is a type of cloud computing infrastructure " +"which abstracts and manages infrastructure, routing, and scaling of web " +"applications. When using a PaaS, application developers can focus on " +"writing application code rather than needing to be concerned with " +"deployment details." +msgstr "" + +#: ../../scenarios/web.rst:267 +msgid "Heroku" +msgstr "" + +#: ../../scenarios/web.rst:269 +msgid "" +"`Heroku `_ offers first-class support for " +"Python 2.7–3.5 applications." +msgstr "" + +#: ../../scenarios/web.rst:272 +msgid "" +"Heroku supports all types of Python web applications, servers, and " +"frameworks. Applications can be developed on Heroku for free. Once your " +"application is ready for production, you can upgrade to a Hobby or " +"Professional application." +msgstr "" + +#: ../../scenarios/web.rst:276 +msgid "" +"Heroku maintains `detailed articles " +"`_ on using " +"Python with Heroku, as well as `step-by-step instructions " +"`_ on " +"how to set up your first application." +msgstr "" + +#: ../../scenarios/web.rst:281 +msgid "" +"Heroku is the recommended PaaS for deploying Python web applications " +"today." +msgstr "" + +#: ../../scenarios/web.rst:286 +msgid "Templating" +msgstr "" + +#: ../../scenarios/web.rst:288 +msgid "" +"Most WSGI applications are responding to HTTP requests to serve content " +"in HTML or other markup languages. Instead of directly generating textual" +" content from Python, the concept of separation of concerns advises us to" +" use templates. A template engine manages a suite of template files, with" +" a system of hierarchy and inclusion to avoid unnecessary repetition, and" +" is in charge of rendering (generating) the actual content, filling the " +"static content of the templates with the dynamic content generated by the" +" application." +msgstr "" + +#: ../../scenarios/web.rst:296 +msgid "" +"As template files are sometimes written by designers or front-end " +"developers, it can be difficult to handle increasing complexity." +msgstr "" + +#: ../../scenarios/web.rst:300 +msgid "" +"Some general good practices apply to the part of the application passing " +"dynamic content to the template engine, and to the templates themselves." +msgstr "" + +#: ../../scenarios/web.rst:303 +msgid "" +"Template files should be passed only the dynamic content that is needed " +"for rendering the template. Avoid the temptation to pass additional " +"content \"just in case\": it is easier to add some missing variable when " +"needed than to remove a likely unused variable later." +msgstr "" + +#: ../../scenarios/web.rst:309 +msgid "" +"Many template engines allow for complex statements or assignments in the " +"template itself, and many allow some Python code to be evaluated in the " +"templates. This convenience can lead to uncontrolled increase in " +"complexity, and often make it harder to find bugs." +msgstr "" + +#: ../../scenarios/web.rst:315 +msgid "" +"It is often necessary to mix JavaScript templates with HTML templates. A " +"sane approach to this design is to isolate the parts where the HTML " +"template passes some variable content to the JavaScript code." +msgstr "" + +#: ../../scenarios/web.rst:323 +msgid "Jinja2" +msgstr "" + +#: ../../scenarios/web.rst:324 +msgid "" +"`Jinja2 `_ is a very well-regarded template " +"engine." +msgstr "" + +#: ../../scenarios/web.rst:326 +msgid "" +"It uses a text-based template language and can thus be used to generate " +"any type of markup, not just HTML. It allows customization of filters, " +"tags, tests, and globals. It features many improvements over Django's " +"templating system." +msgstr "" + +#: ../../scenarios/web.rst:330 +msgid "Here some important HTML tags in Jinja2:" +msgstr "" + +#: ../../scenarios/web.rst:350 +msgid "" +"The next listings are an example of a web site in combination with the " +"Tornado web server. Tornado is not very complicated to use." +msgstr "" + +#: ../../scenarios/web.rst:391 +msgid "" +"The :file:`base.html` file can be used as base for all site pages which " +"are for example implemented in the content block." +msgstr "" + +#: ../../scenarios/web.rst:416 +msgid "" +"The next listing is our site page (:file:`site.html`) loaded in the " +"Python app which extends :file:`base.html`. The content block is " +"automatically set into the corresponding block in the :file:`base.html` " +"page." +msgstr "" + +#: ../../scenarios/web.rst:438 +msgid "" +"Jinja2 is the recommended templating library for new Python web " +"applications." +msgstr "" + +#: ../../scenarios/web.rst:441 +msgid "Chameleon" +msgstr "" + +#: ../../scenarios/web.rst:443 +msgid "" +"`Chameleon `_ Page Templates are an " +"HTML/XML template engine implementation of the `Template Attribute " +"Language (TAL) " +"`_, `TAL " +"Expression Syntax (TALES) " +"`_, and `Macro Expansion TAL (Metal) " +"`_ syntaxes." +msgstr "" + +#: ../../scenarios/web.rst:448 +msgid "" +"Chameleon is available for Python 2.5 and up (including 3.x and PyPy), " +"and is commonly used by the `Pyramid Framework " +"`_." +msgstr "" + +#: ../../scenarios/web.rst:451 +msgid "" +"Page Templates add within your document structure special element " +"attributes and text markup. Using a set of simple language constructs, " +"you control the document flow, element repetition, text replacement, and " +"translation. Because of the attribute-based syntax, unrendered page " +"templates are valid HTML and can be viewed in a browser and even edited " +"in WYSIWYG editors. This can make round-trip collaboration with designers" +" and prototyping with static files in a browser easier." +msgstr "" + +#: ../../scenarios/web.rst:459 +msgid "The basic TAL language is simple enough to grasp from an example:" +msgstr "" + +#: ../../scenarios/web.rst:477 +msgid "" +"The `` pattern for text insertion is " +"common enough that if you do not require strict validity in your " +"unrendered templates, you can replace it with a more terse and readable " +"syntax that uses the pattern `${expression}`, as follows:" +msgstr "" + +#: ../../scenarios/web.rst:498 +msgid "" +"But keep in mind that the full `Default " +"Text` syntax also allows for default content in the unrendered " +"template." +msgstr "" + +#: ../../scenarios/web.rst:501 +msgid "Being from the Pyramid world, Chameleon is not widely used." +msgstr "" + +#: ../../scenarios/web.rst:504 +msgid "Mako" +msgstr "" + +#: ../../scenarios/web.rst:506 +msgid "" +"`Mako `_ is a template language that " +"compiles to Python for maximum performance. Its syntax and API are " +"borrowed from the best parts of other templating languages like Django " +"and Jinja2 templates. It is the default template language included with " +"the `Pylons and Pyramid `_ web frameworks." +msgstr "" + +#: ../../scenarios/web.rst:512 +msgid "An example template in Mako looks like:" +msgstr "" + +#: ../../scenarios/web.rst:534 +msgid "To render a very basic template, you can do the following:" +msgstr "" + +#: ../../scenarios/web.rst:541 +msgid "Mako is well respected within the Python web community." +msgstr "" + +#: ../../scenarios/web.rst:544 +msgid "References" +msgstr "" + +#: ../../scenarios/web.rst:545 +msgid "" +"`Benchmark of Python WSGI Servers `_" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/scenarios/xml.po b/locales/zh_CN/LC_MESSAGES/scenarios/xml.po new file mode 100644 index 000000000..14234fc29 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/scenarios/xml.po @@ -0,0 +1,84 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../scenarios/xml.rst:4 +msgid "XML parsing" +msgstr "" + +#: ../../scenarios/xml.rst:11 +msgid "untangle" +msgstr "" + +#: ../../scenarios/xml.rst:13 +msgid "" +"`untangle `_ is a simple library " +"which takes an XML document and returns a Python object which mirrors the" +" nodes and attributes in its structure." +msgstr "" + +#: ../../scenarios/xml.rst:17 +msgid "For example, an XML file like this:" +msgstr "" + +#: ../../scenarios/xml.rst:26 +msgid "can be loaded like this:" +msgstr "" + +#: ../../scenarios/xml.rst:33 +msgid "and then you can get the child element's name attribute like this:" +msgstr "" + +#: ../../scenarios/xml.rst:39 +msgid "untangle also supports loading XML from a string or a URL." +msgstr "" + +#: ../../scenarios/xml.rst:44 +msgid "xmltodict" +msgstr "" + +#: ../../scenarios/xml.rst:46 +msgid "" +"`xmltodict `_ is another simple" +" library that aims at making XML feel like working with JSON." +msgstr "" + +#: ../../scenarios/xml.rst:49 +msgid "An XML file like this:" +msgstr "" + +#: ../../scenarios/xml.rst:63 +msgid "can be loaded into a Python dict like this:" +msgstr "" + +#: ../../scenarios/xml.rst:72 +msgid "and then you can access elements, attributes, and values like this:" +msgstr "" + +#: ../../scenarios/xml.rst:81 +msgid "" +"xmltodict also lets you roundtrip back to XML with the unparse function, " +"has a streaming mode suitable for handling files that don't fit in " +"memory, and supports XML namespaces." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/shipping/freezing.po b/locales/zh_CN/LC_MESSAGES/shipping/freezing.po new file mode 100644 index 000000000..b51be31f3 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/shipping/freezing.po @@ -0,0 +1,471 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../shipping/freezing.rst:6 +msgid "Freezing Your Code" +msgstr "" + +#: ../../shipping/freezing.rst:10 +msgid "" +"\"Freezing\" your code is creating a single-file executable file to " +"distribute to end-users, that contains all of your application code as " +"well as the Python interpreter." +msgstr "" + +#: ../../shipping/freezing.rst:14 +msgid "" +"Applications such as 'Dropbox', 'Eve Online', 'Civilization IV', and " +"BitTorrent clients do this." +msgstr "" + +#: ../../shipping/freezing.rst:17 +msgid "" +"The advantage of distributing this way is that your application will " +"\"just work\", even if the user doesn't already have the required version" +" of Python (or any) installed. On Windows, and even on many Linux " +"distributions and OS X, the right version of Python will not already be " +"installed." +msgstr "" + +#: ../../shipping/freezing.rst:22 +msgid "" +"Besides, end-user software should always be in an executable format. " +"Files ending in ``.py`` are for software engineers and system " +"administrators." +msgstr "" + +#: ../../shipping/freezing.rst:25 +msgid "" +"One disadvantage of freezing is that it will increase the size of your " +"distribution by about 2–12 MB. Also, you will be responsible for shipping" +" updated versions of your application when security vulnerabilities to " +"Python are patched." +msgstr "" + +#: ../../shipping/freezing.rst:33 +msgid "Alternatives to Freezing" +msgstr "" + +#: ../../shipping/freezing.rst:35 +msgid "" +":ref:`Packaging your code ` is for distributing " +"libraries or tools to other developers." +msgstr "" + +#: ../../shipping/freezing.rst:38 +msgid "" +"On Linux, an alternative to freezing is to :ref:`create a Linux distro " +"package ` (e.g. .deb files for " +"Debian or Ubuntu, or .rpm files for Red Hat and SuSE.)" +msgstr "" + +#: ../../shipping/freezing.rst:42 +msgid "待处理" +msgstr "" + +#: ../../shipping/freezing.rst:42 +msgid "Fill in \"Freezing Your Code\" stub" +msgstr "" + +#: ../../shipping/freezing.rst:47 +msgid "Comparison of Freezing Tools" +msgstr "" + +#: ../../shipping/freezing.rst:49 +msgid "" +"Date of this writing: Oct 5, 2019 Solutions and platforms/features " +"supported:" +msgstr "" + +#: ../../shipping/freezing.rst:53 +msgid "Solution" +msgstr "" + +#: ../../shipping/freezing.rst:53 ../../shipping/freezing.rst:75 +msgid "Windows" +msgstr "" + +#: ../../shipping/freezing.rst:53 ../../shipping/freezing.rst:220 +msgid "Linux" +msgstr "" + +#: ../../shipping/freezing.rst:53 ../../shipping/freezing.rst:164 +msgid "OS X" +msgstr "" + +#: ../../shipping/freezing.rst:53 +msgid "Python 3" +msgstr "" + +#: ../../shipping/freezing.rst:53 +msgid "License" +msgstr "" + +#: ../../shipping/freezing.rst:53 +msgid "One-file mode" +msgstr "" + +#: ../../shipping/freezing.rst:53 +msgid "Zipfile import" +msgstr "" + +#: ../../shipping/freezing.rst:53 +msgid "Eggs" +msgstr "" + +#: ../../shipping/freezing.rst:53 +msgid "pkg_resources support" +msgstr "" + +#: ../../shipping/freezing.rst:53 +msgid "Latest release date" +msgstr "" + +#: ../../shipping/freezing.rst:55 ../../shipping/freezing.rst:78 +#: ../../shipping/freezing.rst:224 +msgid "bbFreeze" +msgstr "" + +#: ../../shipping/freezing.rst:55 ../../shipping/freezing.rst:56 +#: ../../shipping/freezing.rst:57 ../../shipping/freezing.rst:58 +#: ../../shipping/freezing.rst:59 +msgid "yes" +msgstr "" + +#: ../../shipping/freezing.rst:55 ../../shipping/freezing.rst:56 +#: ../../shipping/freezing.rst:57 ../../shipping/freezing.rst:58 +#: ../../shipping/freezing.rst:59 +msgid "no" +msgstr "" + +#: ../../shipping/freezing.rst:55 ../../shipping/freezing.rst:56 +#: ../../shipping/freezing.rst:59 +msgid "MIT" +msgstr "" + +#: ../../shipping/freezing.rst:55 +msgid "Jan 20, 2014" +msgstr "" + +#: ../../shipping/freezing.rst:56 ../../shipping/freezing.rst:124 +msgid "py2exe" +msgstr "" + +#: ../../shipping/freezing.rst:56 +msgid "Oct 21, 2014" +msgstr "" + +#: ../../shipping/freezing.rst:57 +msgid "pyInstaller" +msgstr "" + +#: ../../shipping/freezing.rst:57 +msgid "GPL" +msgstr "" + +#: ../../shipping/freezing.rst:57 +msgid "Jul 9, 2019" +msgstr "" + +#: ../../shipping/freezing.rst:58 +msgid "cx_Freeze" +msgstr "" + +#: ../../shipping/freezing.rst:58 +msgid "PSF" +msgstr "" + +#: ../../shipping/freezing.rst:58 +msgid "Aug 29, 2019" +msgstr "" + +#: ../../shipping/freezing.rst:59 ../../shipping/freezing.rst:168 +msgid "py2app" +msgstr "" + +#: ../../shipping/freezing.rst:59 +msgid "Mar 25, 2019" +msgstr "" + +#: ../../shipping/freezing.rst:63 +msgid "" +"Freezing Python code on Linux into a Windows executable was only once " +"supported in PyInstaller `and later dropped " +"`_." +msgstr "" + +#: ../../shipping/freezing.rst:68 +msgid "" +"All solutions need a Microsoft Visual C++ to be installed on the target " +"machine, except py2app. Only PyInstaller makes a self-executable exe that" +" bundles the appropriate DLL when passing ``--onefile`` to " +":file:`Configure.py`." +msgstr "" + +#: ../../shipping/freezing.rst:80 +msgid "" +"Prerequisite is to install :ref:`Python, Setuptools and pywin32 " +"dependency on Windows `." +msgstr "" + +#: ../../shipping/freezing.rst:82 +msgid "Install :code:`bbfreeze`:" +msgstr "" + +#: ../../shipping/freezing.rst:88 +msgid "Write most basic :file:`bb_setup.py`" +msgstr "" + +#: ../../shipping/freezing.rst:100 +msgid "" +"This will work for the most basic one file scripts. For more advanced " +"freezing you will have to provide include and exclude paths like so:" +msgstr "" + +#: ../../shipping/freezing.rst:107 +msgid "(Optionally) include icon" +msgstr "" + +#: ../../shipping/freezing.rst:113 +msgid "" +"4. Provide the Microsoft Visual C++ runtime DLL for the freezer. It might" +" be possible to append your :code:`sys.path` with the Microsoft Visual " +"Studio path but I find it easier to drop :file:`msvcp90.dll` in the same " +"folder where your script resides." +msgstr "" + +#: ../../shipping/freezing.rst:117 +msgid "Freeze!" +msgstr "" + +#: ../../shipping/freezing.rst:126 +msgid "" +"Prerequisite is to install :ref:`Python on Windows `. " +"The last release of py2exe is from the year 2014. There is not active " +"development." +msgstr "" + +#: ../../shipping/freezing.rst:128 +msgid "Download and install http://sourceforge.net/projects/py2exe/files/py2exe/" +msgstr "" + +#: ../../shipping/freezing.rst:130 +msgid "" +"Write :file:`setup.py` (`List of configuration options " +"`_):" +msgstr "" + +#: ../../shipping/freezing.rst:141 +msgid "(Optionally) `include icon `_" +msgstr "" + +#: ../../shipping/freezing.rst:143 +msgid "" +"(Optionally) `one-file mode `_" +msgstr "" + +#: ../../shipping/freezing.rst:145 +msgid "Generate :file:`.exe` into :file:`dist` directory:" +msgstr "" + +#: ../../shipping/freezing.rst:151 +msgid "" +"Provide the Microsoft Visual C++ runtime DLL. Two options: `globally " +"install dll on target machine `_ or `distribute dll alongside with .exe " +"`_." +msgstr "" + +#: ../../shipping/freezing.rst:154 ../../shipping/freezing.rst:171 +#: ../../shipping/freezing.rst:263 +msgid "PyInstaller" +msgstr "" + +#: ../../shipping/freezing.rst:156 +msgid "" +"Prerequisite is to have installed :ref:`Python, Setuptools and pywin32 " +"dependency on Windows `." +msgstr "" + +#: ../../shipping/freezing.rst:158 +msgid "" +"`Most basic tutorial `_" +msgstr "" + +#: ../../shipping/freezing.rst:159 +msgid "`Manual `_" +msgstr "" + +#: ../../shipping/freezing.rst:173 +msgid "" +"PyInstaller can be used to build Unix executables and windowed apps on " +"Mac OS X 10.6 (Snow Leopard) or newer." +msgstr "" + +#: ../../shipping/freezing.rst:175 +msgid "To install PyInstaller, use pip:" +msgstr "" + +#: ../../shipping/freezing.rst:181 +msgid "To create a standard Unix executable, from say :code:`script.py`, use:" +msgstr "" + +#: ../../shipping/freezing.rst:187 +msgid "This creates:" +msgstr "" + +#: ../../shipping/freezing.rst:189 +msgid "a :code:`script.spec` file, analogous to a :code:`make` file" +msgstr "" + +#: ../../shipping/freezing.rst:190 +msgid "a :code:`build` folder, that holds some log files" +msgstr "" + +#: ../../shipping/freezing.rst:191 +msgid "" +"a :code:`dist` folder, that holds the main executable :code:`script`, and" +" some dependent Python libraries" +msgstr "" + +#: ../../shipping/freezing.rst:193 +msgid "" +"all in the same folder as :code:`script.py`. PyInstaller puts all the " +"Python libraries used in :code:`script.py` into the :code:`dist` folder, " +"so when distributing the executable, distribute the whole :code:`dist` " +"folder." +msgstr "" + +#: ../../shipping/freezing.rst:195 +msgid "" +"The :code:`script.spec` file can be edited to `customise the build " +"`_, with " +"options such as:" +msgstr "" + +#: ../../shipping/freezing.rst:197 +msgid "bundling data files with the executable" +msgstr "" + +#: ../../shipping/freezing.rst:198 +msgid "" +"including run-time libraries (:code:`.dll` or :code:`.so` files) that " +"PyInstaller can't infer automatically" +msgstr "" + +#: ../../shipping/freezing.rst:199 +msgid "adding Python run-time options to the executable" +msgstr "" + +#: ../../shipping/freezing.rst:201 +msgid "" +"Now :code:`script.spec` can be run with :code:`pyinstaller` (instead of " +"using :code:`script.py` again):" +msgstr "" + +#: ../../shipping/freezing.rst:207 +msgid "" +"To create a standalone windowed OS X application, use the " +":code:`--windowed` option:" +msgstr "" + +#: ../../shipping/freezing.rst:213 +msgid "" +"This creates a :code:`script.app` in the :code:`dist` folder. Make sure " +"to use GUI packages in your Python code, like `PyQt " +"`_ or `PySide " +"`_, to control the graphical parts of the" +" app." +msgstr "" + +#: ../../shipping/freezing.rst:215 +msgid "" +"There are several options in :code:`script.spec` related to Mac OS X app " +"bundles `here `_. For example, to specify an icon " +"for the app, use the :code:`icon=\\path\\to\\icon.icns` option." +msgstr "" + +#: ../../shipping/freezing.rst:225 +msgid "" +"bbFreeze will ONLY work in Python 2.x environment, since it's no longer " +"being maintained as stated by it's former maintainer. If you're " +"interested in it, check the repository in `here " +"`_." +msgstr "" + +#: ../../shipping/freezing.rst:227 +msgid "" +"bbFreeze can be used with all distributions that has Python installed " +"along with pip2 and/or easy_install." +msgstr "" + +#: ../../shipping/freezing.rst:229 +msgid "For pip2, use the following:" +msgstr "" + +#: ../../shipping/freezing.rst:235 +msgid "Or, for easy_install:" +msgstr "" + +#: ../../shipping/freezing.rst:241 +msgid "With bbFreeze installed, you're ready to freeze your applications." +msgstr "" + +#: ../../shipping/freezing.rst:243 +msgid "" +"Let's assume you have a script, say, \"hello.py\" and a module called " +"\"module.py\" and you have a function in it that's being used in your " +"script. No need to worry, you can just ask to freeze the main entrypoint " +"of your script and it should freeze entirely:" +msgstr "" + +#: ../../shipping/freezing.rst:250 +msgid "" +"With this, it creates a folder called dist/, of which contains the " +"executable of the script and required .so (shared objects) files linked " +"against libraries used within the Python script." +msgstr "" + +#: ../../shipping/freezing.rst:252 +msgid "" +"Alternatively, you can create a script that does the freezing for you. An" +" API for the freezer is available from the library within:" +msgstr "" + +#: ../../shipping/freezing.rst:264 +msgid "" +"PyInstaller can be used in a similar fashion as in OS X. The installation" +" goes in the same manner as shown in the OS X section." +msgstr "" + +#: ../../shipping/freezing.rst:266 +msgid "" +"Don't forget to have dependencies such as Python and pip installed for " +"usage." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/shipping/packaging.po b/locales/zh_CN/LC_MESSAGES/shipping/packaging.po new file mode 100644 index 000000000..2092a43f1 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/shipping/packaging.po @@ -0,0 +1,353 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../shipping/packaging.rst:6 +msgid "Packaging Your Code" +msgstr "" + +#: ../../shipping/packaging.rst:10 +msgid "" +"Package your code to share it with other developers. For example, to " +"share a library for other developers to use in their application, or for " +"development tools like 'py.test'." +msgstr "" + +#: ../../shipping/packaging.rst:14 +msgid "" +"An advantage of this method of distribution is its well established " +"ecosystem of tools such as PyPI and pip, which make it easy for other " +"developers to download and install your package either for casual " +"experiments, or as part of large, professional systems." +msgstr "" + +#: ../../shipping/packaging.rst:19 +msgid "" +"It is a well-established convention for Python code to be shared this " +"way. If your code isn't packaged on PyPI, then it will be harder for " +"other developers to find it and to use it as part of their existing " +"process. They will regard such projects with substantial suspicion of " +"being either badly managed or abandoned." +msgstr "" + +#: ../../shipping/packaging.rst:25 +msgid "" +"The downside of distributing code like this is that it relies on the " +"recipient understanding how to install the required version of Python, " +"and being able and willing to use tools such as pip to install your " +"code's other dependencies. This is fine when distributing to other " +"developers, but makes this method unsuitable for distributing " +"applications to end-users." +msgstr "" + +#: ../../shipping/packaging.rst:31 +msgid "" +"The `Python Packaging Guide `_ provides an extensive guide on creating and " +"maintaining Python packages." +msgstr "" + +#: ../../shipping/packaging.rst:37 +msgid "Alternatives to Packaging" +msgstr "" + +#: ../../shipping/packaging.rst:39 +msgid "" +"To distribute applications to end-users, you should :ref:`freeze your " +"application `." +msgstr "" + +#: ../../shipping/packaging.rst:42 +msgid "" +"On Linux, you may also want to consider :ref:`creating a Linux distro " +"package ` (e.g. a .deb file for " +"Debian or Ubuntu.)" +msgstr "" + +#: ../../shipping/packaging.rst:49 +msgid "For Python Developers" +msgstr "" + +#: ../../shipping/packaging.rst:51 +msgid "" +"If you're writing an open source Python module, `PyPI `_" +" , more properly known as *The Cheeseshop*, is the place to host it." +msgstr "" + +#: ../../shipping/packaging.rst:57 +msgid "Pip vs. easy_install" +msgstr "" + +#: ../../shipping/packaging.rst:59 +msgid "" +"Use `pip `_. More details `here " +"`_." +msgstr "" + +#: ../../shipping/packaging.rst:64 +msgid "Personal PyPI" +msgstr "" + +#: ../../shipping/packaging.rst:66 +msgid "" +"If you want to install packages from a source other than PyPI (say, if " +"your packages are *proprietary*), you can do it by hosting a simple HTTP " +"server, running from the directory which holds those packages which need " +"to be installed." +msgstr "" + +#: ../../shipping/packaging.rst:71 +msgid "**Showing an example is always beneficial**" +msgstr "" + +#: ../../shipping/packaging.rst:73 +msgid "" +"For example, if you want to install a package called " +":file:`MyPackage.tar.gz`, and assuming this is your directory structure:" +msgstr "" + +#: ../../shipping/packaging.rst:79 +msgid "archive" +msgstr "" + +#: ../../shipping/packaging.rst:79 +msgid "MyPackage" +msgstr "" + +#: ../../shipping/packaging.rst:79 +msgid "MyPackage.tar.gz" +msgstr "" + +#: ../../shipping/packaging.rst:81 +msgid "Go to your command prompt and type:" +msgstr "" + +#: ../../shipping/packaging.rst:88 +msgid "" +"This runs a simple HTTP server running on port 9000 and will list all " +"packages (like **MyPackage**). Now you can install **MyPackage** using " +"any Python package installer. Using pip, you would do it like:" +msgstr "" + +#: ../../shipping/packaging.rst:96 +msgid "" +"Having a folder with the same name as the package name is **crucial** " +"here. I got fooled by that, one time. But if you feel that creating a " +"folder called :file:`MyPackage` and keeping :file:`MyPackage.tar.gz` " +"inside that is *redundant*, you can still install MyPackage using:" +msgstr "" + +#: ../../shipping/packaging.rst:106 +msgid "pypiserver" +msgstr "" + +#: ../../shipping/packaging.rst:108 +msgid "" +"`pypiserver `_ is a minimal PyPI " +"compatible server. It can be used to serve a set of packages to " +"easy_install or pip. It includes helpful features like an administrative" +" command (``-U``) which will update all its packages to their latest " +"versions found on PyPI." +msgstr "" + +#: ../../shipping/packaging.rst:116 +msgid "S3-Hosted PyPi" +msgstr "" + +#: ../../shipping/packaging.rst:118 +msgid "" +"One simple option for a personal PyPI server is to use Amazon S3. A " +"prerequisite for this is that you have an Amazon AWS account with an S3 " +"bucket." +msgstr "" + +#: ../../shipping/packaging.rst:121 +msgid "**Install all your requirements from PyPi or another source**" +msgstr "" + +#: ../../shipping/packaging.rst:122 +msgid "**Install pip2pi**" +msgstr "" + +#: ../../shipping/packaging.rst:124 +msgid ":code:`pip install git+https://github.com/wolever/pip2pi.git`" +msgstr "" + +#: ../../shipping/packaging.rst:126 +msgid "**Follow pip2pi README for pip2tgz and dir2pi commands**" +msgstr "" + +#: ../../shipping/packaging.rst:128 +msgid "" +":code:`pip2tgz packages/ YourPackage` (or :code:`pip2tgz packages/ -r " +"requirements.txt`)" +msgstr "" + +#: ../../shipping/packaging.rst:129 +msgid ":code:`dir2pi packages/`" +msgstr "" + +#: ../../shipping/packaging.rst:131 +msgid "**Upload the new files**" +msgstr "" + +#: ../../shipping/packaging.rst:133 +msgid "" +"Use a client like Cyberduck to sync the entire :file:`packages` folder to" +" your s3 bucket." +msgstr "" + +#: ../../shipping/packaging.rst:134 +msgid "" +"Make sure you upload :code:`packages/simple/index.html` as well as all " +"new files and directories." +msgstr "" + +#: ../../shipping/packaging.rst:136 +msgid "**Fix new file permissions**" +msgstr "" + +#: ../../shipping/packaging.rst:138 +msgid "" +"By default, when you upload new files to the S3 bucket, they will have " +"the wrong permissions set." +msgstr "" + +#: ../../shipping/packaging.rst:139 +msgid "" +"Use the Amazon web console to set the READ permission of the files to " +"EVERYONE." +msgstr "" + +#: ../../shipping/packaging.rst:140 +msgid "" +"If you get HTTP 403 when trying to install a package, make sure you've " +"set the permissions correctly." +msgstr "" + +#: ../../shipping/packaging.rst:142 +msgid "**All done**" +msgstr "" + +#: ../../shipping/packaging.rst:144 +msgid "" +"You can now install your package with :code:`pip install --index-" +"url=http://your-s3-bucket/packages/simple/ YourPackage`." +msgstr "" + +#: ../../shipping/packaging.rst:151 +msgid "For Linux Distributions" +msgstr "" + +#: ../../shipping/packaging.rst:153 +msgid "" +"Creating a Linux distro package is arguably the \"right way\" to " +"distribute code on Linux." +msgstr "" + +#: ../../shipping/packaging.rst:156 +msgid "" +"Because a distribution package doesn't include the Python interpreter, it" +" makes the download and install about 2-12 MB smaller than :ref:`freezing" +" your application `." +msgstr "" + +#: ../../shipping/packaging.rst:160 +msgid "" +"Also, if a distribution releases a new security update for Python, then " +"your application will automatically start using that new version of " +"Python." +msgstr "" + +#: ../../shipping/packaging.rst:163 +msgid "" +"The bdist_rpm command makes `producing an RPM file " +"`_ for use by distributions like Red Hat or SuSE trivially easy." +msgstr "" + +#: ../../shipping/packaging.rst:166 +msgid "" +"However, creating and maintaining the different configurations required " +"for each distribution's format (e.g. .deb for Debian/Ubuntu, .rpm for Red" +" Hat/Fedora, etc.) is a fair amount of work. If your code is an " +"application that you plan to distribute on other platforms, then you'll " +"also have to create and maintain the separate config required to freeze " +"your application for Windows and OS X. It would be much less work to " +"simply create and maintain a single config for one of the cross platform " +":ref:`freezing tools `, which will produce stand-" +"alone executables for all distributions of Linux, as well as Windows and " +"OS X." +msgstr "" + +#: ../../shipping/packaging.rst:176 +msgid "" +"Creating a distribution package is also problematic if your code is for a" +" version of Python that isn't currently supported by a distribution. " +"Having to tell *some versions* of Ubuntu end-users that they need to add " +"`the 'dead-snakes' PPA " +"`_ using `sudo " +"apt-repository` commands before they can install your .deb file makes for" +" an extremely hostile user experience. Not only that, but you'd have to " +"maintain a custom equivalent of these instructions for every " +"distribution, and worse, have your users read, understand, and act on " +"them." +msgstr "" + +#: ../../shipping/packaging.rst:185 +msgid "Having said all that, here's how to do it:" +msgstr "" + +#: ../../shipping/packaging.rst:187 +msgid "`Fedora `_" +msgstr "" + +#: ../../shipping/packaging.rst:188 +msgid "" +"`Debian and Ubuntu `_" +msgstr "" + +#: ../../shipping/packaging.rst:189 +msgid "`Arch `_" +msgstr "" + +#: ../../shipping/packaging.rst:192 +msgid "Useful Tools" +msgstr "" + +#: ../../shipping/packaging.rst:194 +msgid "`fpm `_" +msgstr "" + +#: ../../shipping/packaging.rst:195 +msgid "`alien `_" +msgstr "" + +#: ../../shipping/packaging.rst:196 +msgid "" +"`dh-virtualenv `_ (for APT/DEB " +"omnibus packaging)" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/shipping/publishing.po b/locales/zh_CN/LC_MESSAGES/shipping/publishing.po new file mode 100644 index 000000000..ceae6b5da --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/shipping/publishing.po @@ -0,0 +1,124 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../shipping/publishing.rst:6 +msgid "Publishing Your Code" +msgstr "" + +#: ../../shipping/publishing.rst:8 +msgid "待处理" +msgstr "" + +#: ../../shipping/publishing.rst:8 +msgid "Replace this kitten with the photo we want." +msgstr "" + +#: ../../shipping/publishing.rst:12 +msgid "" +"A healthy open source project needs a place to publish its code and " +"project management stuff so other developers can collaborate with you. " +"This lets your users gain a better understanding of your code, keep up " +"with new developments, report bugs, and contribute code." +msgstr "" + +#: ../../shipping/publishing.rst:17 +msgid "" +"This development web site should include the source code history itself, " +"a bug tracker, a patch submission (aka \"Pull Request\") queue, and " +"possibly additional developer-oriented documentation." +msgstr "" + +#: ../../shipping/publishing.rst:21 +msgid "" +"There are several free open source project hosting sites (aka " +"\"forges\"). These include GitHub, SourceForge, Bitbucket, and GitLab. " +"GitHub is currently the best. Use GitHub." +msgstr "" + +#: ../../shipping/publishing.rst:28 +msgid "Creating a Project Repo on GitHub" +msgstr "" + +#: ../../shipping/publishing.rst:30 +msgid "To publish your Python project on GitHub:" +msgstr "" + +#: ../../shipping/publishing.rst:32 +msgid "Create a GitHub account if you don't already have one." +msgstr "" + +#: ../../shipping/publishing.rst:34 +msgid "Create a new repo for your project." +msgstr "" + +#: ../../shipping/publishing.rst:36 +msgid "" +"Click on the \"+\" menu next to your avatar in the upper right of the " +"page and choose \"New repository\"." +msgstr "" + +#: ../../shipping/publishing.rst:38 +msgid "Name it after your project and give it an SEO-friendly description." +msgstr "" + +#: ../../shipping/publishing.rst:40 +msgid "" +"If you don't have an existing project repo, choose the settings to add a " +"README, `.gitignore`, and license. Use the Python `.gitignore` option." +msgstr "" + +#: ../../shipping/publishing.rst:43 +msgid "" +"On the newly created repo page, click \"Manage topics\" and add the tags " +"\"python\" and \"python3\" and/or \"python2\" as appropriate." +msgstr "" + +#: ../../shipping/publishing.rst:45 +msgid "" +"Include a link to your new GitHub repo in your project's README file so " +"people who just have the project distribution know where to find it." +msgstr "" + +#: ../../shipping/publishing.rst:47 +msgid "" +"If this is a brand new repo, clone it to your local machine and start " +"working:" +msgstr "" + +#: ../../shipping/publishing.rst:53 +msgid "" +"Or, if you already have a project Git repo, add your new GitHub repo as a" +" remote:" +msgstr "" + +#: ../../shipping/publishing.rst:63 +msgid "When Your Project Grows" +msgstr "" + +#: ../../shipping/publishing.rst:65 +msgid "" +"For more information about managing an open source software project, see " +"the book `Producing Open Source Software `_." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/starting/install/linux.po b/locales/zh_CN/LC_MESSAGES/starting/install/linux.po new file mode 100644 index 000000000..de594a6b6 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/starting/install/linux.po @@ -0,0 +1,137 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../starting/install/linux.rst:6 +msgid "Installing Python 2 on Linux" +msgstr "" + +#: ../../starting/install/linux.rst:11 +msgid "" +"Check out our :ref:`guide for installing Python 3 on " +"Linux`." +msgstr "" + +#: ../../starting/install/linux.rst:13 +msgid "" +"The latest versions of CentOS, Red Hat Enterprise Linux (RHEL) and Ubuntu" +" **come with Python 2.7 out of the box**." +msgstr "" + +#: ../../starting/install/linux.rst:16 +msgid "" +"To see which version of Python you have installed, open a command prompt " +"and run" +msgstr "" + +#: ../../starting/install/linux.rst:22 +msgid "" +"However, with the growing popularity of Python 3, some distributions, " +"such as Fedora, don't come with Python 2 pre-installed. You can install " +"the ``python2`` package with your distribution package manager:" +msgstr "" + +#: ../../starting/install/linux.rst:30 +msgid "" +"You do not need to install or configure anything else to use Python. " +"Having said that, I would strongly recommend that you install the tools " +"and libraries described in the next section before you start building " +"Python applications for real-world use. In particular, you should always " +"install Setuptools and pip, as it makes it much easier for you to use " +"other third-party Python libraries." +msgstr "" + +#: ../../starting/install/linux.rst:39 +msgid "Setuptools & Pip" +msgstr "" + +#: ../../starting/install/linux.rst:41 +msgid "" +"The two most crucial third-party Python packages are `setuptools " +"`_ and `pip " +"`_." +msgstr "" + +#: ../../starting/install/linux.rst:43 +msgid "" +"Once installed, you can download, install and uninstall any compliant " +"Python software product with a single command. It also enables you to add" +" this network installation capability to your own Python software with " +"very little work." +msgstr "" + +#: ../../starting/install/linux.rst:47 +msgid "" +"Python 2.7.9 and later (on the python2 series), and Python 3.4 and later " +"include pip by default." +msgstr "" + +#: ../../starting/install/linux.rst:50 +msgid "To see if pip is installed, open a command prompt and run" +msgstr "" + +#: ../../starting/install/linux.rst:56 +msgid "" +"To install pip, `follow the official pip installation guide " +"`_ - this will automatically " +"install the latest version of setuptools." +msgstr "" + +#: ../../starting/install/linux.rst:61 +msgid "Virtual Environments" +msgstr "" + +#: ../../starting/install/linux.rst:63 +msgid "" +"A Virtual Environment is a tool to keep the dependencies required by " +"different projects in separate places, by creating virtual Python " +"environments for them. It solves the \"Project X depends on version 1.x " +"but, Project Y needs 4.x\" dilemma, and keeps your global site-packages " +"directory clean and manageable." +msgstr "" + +#: ../../starting/install/linux.rst:68 +msgid "" +"For example, you can work on a project which requires Django 1.10 while " +"also maintaining a project which requires Django 1.8." +msgstr "" + +#: ../../starting/install/linux.rst:71 +msgid "" +"To start using this and see more information: :ref:`Virtual Environments " +"` docs." +msgstr "" + +#: ../../starting/install/linux.rst:73 +msgid "" +"You can also use :ref:`virtualenvwrapper ` to make" +" it easier to manage your virtual environments." +msgstr "" + +#: ../../starting/install/linux.rst:78 +msgid "" +"This page is a remixed version of `another guide " +"`_, " +"which is available under the same license." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/starting/install/osx.po b/locales/zh_CN/LC_MESSAGES/starting/install/osx.po new file mode 100644 index 000000000..5aea79f10 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/starting/install/osx.po @@ -0,0 +1,181 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../starting/install/osx.rst:6 +msgid "Installing Python 2 on Mac OS X" +msgstr "" + +#: ../../starting/install/osx.rst:11 +msgid "Check out our :ref:`guide for installing Python 3 on OS X`." +msgstr "" + +#: ../../starting/install/osx.rst:13 +msgid "**Mac OS X comes with Python 2.7 out of the box.**" +msgstr "" + +#: ../../starting/install/osx.rst:15 +msgid "" +"You do not need to install or configure anything else to use Python. " +"Having said that, I would strongly recommend that you install the tools " +"and libraries described in the next section before you start building " +"Python applications for real-world use. In particular, you should always " +"install Setuptools, as it makes it much easier for you to install and " +"manage other third-party Python libraries." +msgstr "" + +#: ../../starting/install/osx.rst:21 +msgid "" +"The version of Python that ships with OS X is great for learning, but " +"it's not good for development. The version shipped with OS X may be out " +"of date from the `official current Python release " +"`_, which is considered the " +"stable production version." +msgstr "" + +#: ../../starting/install/osx.rst:29 +msgid "Doing it Right" +msgstr "" + +#: ../../starting/install/osx.rst:31 +msgid "Let's install a real version of Python." +msgstr "" + +#: ../../starting/install/osx.rst:33 +msgid "" +"Before installing Python, you'll need to install a C compiler. The " +"fastest way is to install the Xcode Command Line Tools by running " +"``xcode-select --install``. You can also download the full version of " +"`Xcode `_ from the Mac App Store, or " +"the minimal but unofficial `OSX-GCC-Installer " +"`_ package." +msgstr "" + +#: ../../starting/install/osx.rst:42 +msgid "" +"If you already have Xcode installed, do not install OSX-GCC-Installer. In" +" combination, the software can cause issues that are difficult to " +"diagnose." +msgstr "" + +#: ../../starting/install/osx.rst:47 +msgid "" +"If you perform a fresh install of Xcode, you will also need to add the " +"commandline tools by running ``xcode-select --install`` on the terminal." +msgstr "" + +#: ../../starting/install/osx.rst:51 +msgid "" +"While OS X comes with a large number of Unix utilities, those familiar " +"with Linux systems will notice one key component missing: a decent " +"package manager. `Homebrew `_ fills this void." +msgstr "" + +#: ../../starting/install/osx.rst:55 +msgid "" +"To `install Homebrew `_, open :file:`Terminal` " +"or your favorite OS X terminal emulator and run" +msgstr "" + +#: ../../starting/install/osx.rst:62 +msgid "" +"The script will explain what changes it will make and prompt you before " +"the installation begins. Once you've installed Homebrew, insert the " +"Homebrew directory at the top of your :envvar:`PATH` environment " +"variable. You can do this by adding the following line at the bottom of " +"your :file:`~/.profile` file" +msgstr "" + +#: ../../starting/install/osx.rst:72 +msgid "Now, we can install Python 2.7:" +msgstr "" + +#: ../../starting/install/osx.rst:78 +msgid "" +"Because ``python@2`` is a \"keg\", we need to update our ``PATH`` again, " +"to point at our new installation:" +msgstr "" + +#: ../../starting/install/osx.rst:84 +msgid "" +"Homebrew names the executable ``python2`` so that you can still run the " +"system Python via the executable ``python``." +msgstr "" + +#: ../../starting/install/osx.rst:96 +msgid "Setuptools & Pip" +msgstr "" + +#: ../../starting/install/osx.rst:98 +msgid "Homebrew installs Setuptools and ``pip`` for you." +msgstr "" + +#: ../../starting/install/osx.rst:100 +msgid "" +"Setuptools enables you to download and install any compliant Python " +"software over a network (usually the Internet) with a single command " +"(``easy_install``). It also enables you to add this network installation " +"capability to your own Python software with very little work." +msgstr "" + +#: ../../starting/install/osx.rst:105 +msgid "" +"``pip`` is a tool for easily installing and managing Python packages, " +"that is recommended over ``easy_install``. It is superior to " +"``easy_install`` in `several ways `_, and is " +"actively maintained." +msgstr "" + +#: ../../starting/install/osx.rst:118 +msgid "Virtual Environments" +msgstr "" + +#: ../../starting/install/osx.rst:120 +msgid "" +"A Virtual Environment (commonly referred to as a 'virtualenv') is a tool " +"to keep the dependencies required by different projects in separate " +"places, by creating virtual Python environments for them. It solves the " +"\"Project X depends on version 1.x but, Project Y needs 4.x\" dilemma, " +"and keeps your global site-packages directory clean and manageable." +msgstr "" + +#: ../../starting/install/osx.rst:125 +msgid "" +"For example, you can work on a project which requires Django 1.10 while " +"also maintaining a project which requires Django 1.8." +msgstr "" + +#: ../../starting/install/osx.rst:128 +msgid "" +"To start using this and see more information: :ref:`Virtual Environments " +"` docs." +msgstr "" + +#: ../../starting/install/osx.rst:132 +msgid "" +"This page is a remixed version of `another guide " +"`_, " +"which is available under the same license." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/starting/install/win.po b/locales/zh_CN/LC_MESSAGES/starting/install/win.po new file mode 100644 index 000000000..86a436f85 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/starting/install/win.po @@ -0,0 +1,158 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../starting/install/win.rst:6 +msgid "Installing Python 2 on Windows" +msgstr "" + +#: ../../starting/install/win.rst:11 +msgid "" +"Check out our :ref:`guide for installing Python 3 on " +"Windows`." +msgstr "" + +#: ../../starting/install/win.rst:13 +msgid "" +"First, download the `latest version " +"`_ of Python " +"2.7 from the official website. If you want to be sure you are installing " +"a fully up-to-date version, click the Downloads > Windows link from the " +"home page of the `Python.org web site `_ ." +msgstr "" + +#: ../../starting/install/win.rst:18 +msgid "" +"The Windows version is provided as an MSI package. To install it " +"manually, just double-click the file. The MSI package format allows " +"Windows administrators to automate installation with their standard " +"tools." +msgstr "" + +#: ../../starting/install/win.rst:22 +msgid "" +"By design, Python installs to a directory with the version number " +"embedded, e.g. Python version 2.7 will install at " +":file:`C:\\\\Python27\\\\`, so that you can have multiple versions of " +"Python on the same system without conflicts. Of course, only one " +"interpreter can be the default application for Python file types. It also" +" does not automatically modify the :envvar:`PATH` environment variable, " +"so that you always have control over which copy of Python is run." +msgstr "" + +#: ../../starting/install/win.rst:30 +msgid "" +"Typing the full path name for a Python interpreter each time quickly gets" +" tedious, so add the directories for your default Python version to the " +":envvar:`PATH`. Assuming that your Python installation is in " +":file:`C:\\\\Python27\\\\`, add this to your :envvar:`PATH`:" +msgstr "" + +#: ../../starting/install/win.rst:39 +msgid "You can do this easily by running the following in ``powershell``:" +msgstr "" + +#: ../../starting/install/win.rst:45 +msgid "This is also an option during the installation process." +msgstr "" + +#: ../../starting/install/win.rst:47 +msgid "" +"The second (:file:`Scripts`) directory receives command files when " +"certain packages are installed, so it is a very useful addition. You do " +"not need to install or configure anything else to use Python. Having said" +" that, I would strongly recommend that you install the tools and " +"libraries described in the next section before you start building Python " +"applications for real-world use. In particular, you should always install" +" Setuptools, as it makes it much easier for you to use other third-party " +"Python libraries." +msgstr "" + +#: ../../starting/install/win.rst:58 +msgid "Setuptools + Pip" +msgstr "" + +#: ../../starting/install/win.rst:60 +msgid "" +"The two most crucial third-party Python packages are `setuptools " +"`_ and `pip " +"`_." +msgstr "" + +#: ../../starting/install/win.rst:62 +msgid "" +"Once installed, you can download, install and uninstall any compliant " +"Python software product with a single command. It also enables you to add" +" this network installation capability to your own Python software with " +"very little work." +msgstr "" + +#: ../../starting/install/win.rst:66 +msgid "" +"Python 2.7.9 and later (on the python2 series), and Python 3.4 and later " +"include pip by default." +msgstr "" + +#: ../../starting/install/win.rst:69 +msgid "To see if pip is installed, open a command prompt and run" +msgstr "" + +#: ../../starting/install/win.rst:75 +msgid "" +"To install pip, `follow the official pip installation guide " +"`_ - this will automatically " +"install the latest version of setuptools." +msgstr "" + +#: ../../starting/install/win.rst:80 +msgid "Virtual Environments" +msgstr "" + +#: ../../starting/install/win.rst:82 +msgid "" +"A Virtual Environment is a tool to keep the dependencies required by " +"different projects in separate places, by creating virtual Python " +"environments for them. It solves the \"Project X depends on version 1.x " +"but, Project Y needs 4.x\" dilemma, and keeps your global site-packages " +"directory clean and manageable." +msgstr "" + +#: ../../starting/install/win.rst:87 +msgid "" +"For example, you can work on a project which requires Django 1.10 while " +"also maintaining a project which requires Django 1.8." +msgstr "" + +#: ../../starting/install/win.rst:90 +msgid "" +"To start using this and see more information: :ref:`Virtual Environments " +"` docs." +msgstr "" + +#: ../../starting/install/win.rst:95 +msgid "" +"This page is a remixed version of `another guide " +"`_, " +"which is available under the same license." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/starting/install3/linux.po b/locales/zh_CN/LC_MESSAGES/starting/install3/linux.po new file mode 100644 index 000000000..10ac0475b --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/starting/install3/linux.po @@ -0,0 +1,173 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../starting/install3/linux.rst:6 +msgid "Installing Python 3 on Linux" +msgstr "" + +#: ../../starting/install3/linux.rst:10 +msgid "" +"This document describes how to install Python 3.6 or 3.8 on Ubuntu Linux " +"machines." +msgstr "" + +#: ../../starting/install3/linux.rst:12 +msgid "" +"To see which version of Python 3 you have installed, open a command " +"prompt and run" +msgstr "" + +#: ../../starting/install3/linux.rst:18 +msgid "" +"If you are using Ubuntu 16.10 or newer, then you can easily install " +"Python 3.6 with the following commands::" +msgstr "" + +#: ../../starting/install3/linux.rst:23 +msgid "" +"If you're using another version of Ubuntu (e.g. the latest LTS release) " +"or you want to use a more current Python, we recommend using the " +"`deadsnakes PPA `_" +" to install Python 3.8::" +msgstr "" + +#: ../../starting/install3/linux.rst:30 +msgid "" +"If you are using other Linux distribution, chances are you already have " +"Python 3 pre-installed as well. If not, use your distribution's package " +"manager. For example on Fedora, you would use `dnf`:" +msgstr "" + +#: ../../starting/install3/linux.rst:38 +msgid "" +"Note that if the version of the ``python3`` package is not recent enough " +"for you, there may be ways of installing more recent versions as well, " +"depending on you distribution. For example installing the ``python3.9`` " +"package on Fedora 32 to get Python 3.9. If you are a Fedora user, you " +"might want to read about `multiple Python versions available in Fedora`_." +msgstr "" + +#: ../../starting/install3/linux.rst:49 +msgid "Working with Python 3" +msgstr "" + +#: ../../starting/install3/linux.rst:51 +msgid "At this point, you may have system Python 2.7 available as well." +msgstr "" + +#: ../../starting/install3/linux.rst:57 +msgid "This might launch the Python 2 interpreter." +msgstr "" + +#: ../../starting/install3/linux.rst:63 +msgid "This will always launch the Python 3 interpreter." +msgstr "" + +#: ../../starting/install3/linux.rst:68 +msgid "Setuptools & Pip" +msgstr "" + +#: ../../starting/install3/linux.rst:70 +msgid "" +"The two most crucial third-party Python packages are `setuptools " +"`_ and `pip " +"`_." +msgstr "" + +#: ../../starting/install3/linux.rst:72 +msgid "" +"Once installed, you can download, install and uninstall any compliant " +"Python software product with a single command. It also enables you to add" +" this network installation capability to your own Python software with " +"very little work." +msgstr "" + +#: ../../starting/install3/linux.rst:76 +msgid "" +"Python 2.7.9 and later (on the python2 series), and Python 3.4 and later " +"include pip by default." +msgstr "" + +#: ../../starting/install3/linux.rst:79 +msgid "To see if pip is installed, open a command prompt and run" +msgstr "" + +#: ../../starting/install3/linux.rst:85 +msgid "" +"To install pip, `follow the official pip installation guide " +"`_ - this will automatically " +"install the latest version of setuptools." +msgstr "" + +#: ../../starting/install3/linux.rst:87 +msgid "" +"Note that on some Linux distributions including Ubuntu and Fedora the " +"``pip`` command is meant for Python 2, while the ``pip3`` command is " +"meant for Python 3." +msgstr "" + +#: ../../starting/install3/linux.rst:94 +msgid "" +"However, when using virtual environments (described below), you don't " +"need to care about that." +msgstr "" + +#: ../../starting/install3/linux.rst:100 +msgid "Pipenv & Virtual Environments" +msgstr "" + +#: ../../starting/install3/linux.rst:102 +msgid "" +"The next step is to install Pipenv, so you can install dependencies and " +"manage virtual environments." +msgstr "" + +#: ../../starting/install3/linux.rst:104 +msgid "" +"A Virtual Environment is a tool to keep the dependencies required by " +"different projects in separate places, by creating virtual Python " +"environments for them. It solves the \"Project X depends on version 1.x " +"but, Project Y needs 4.x\" dilemma, and keeps your global site-packages " +"directory clean and manageable." +msgstr "" + +#: ../../starting/install3/linux.rst:109 +msgid "" +"For example, you can work on a project which requires Django 1.10 while " +"also maintaining a project which requires Django 1.8." +msgstr "" + +#: ../../starting/install3/linux.rst:112 +msgid "" +"So, onward! To the :ref:`Pipenv & Virtual Environments " +"` docs!" +msgstr "" + +#: ../../starting/install3/linux.rst:116 +msgid "" +"This page is a remixed version of `another guide " +"`_, " +"which is available under the same license." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/starting/install3/osx.po b/locales/zh_CN/LC_MESSAGES/starting/install3/osx.po new file mode 100644 index 000000000..68e7f2160 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/starting/install3/osx.po @@ -0,0 +1,187 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../starting/install3/osx.rst:8 +msgid "Installing Python 3 on Mac OS X" +msgstr "" + +#: ../../starting/install3/osx.rst:12 +msgid "**Mac OS X comes with Python 2.7 out of the box.**" +msgstr "" + +#: ../../starting/install3/osx.rst:14 +msgid "" +"You do not need to install or configure anything else to use Python 2. " +"These instructions document the installation of Python 3." +msgstr "" + +#: ../../starting/install3/osx.rst:17 +msgid "" +"The version of Python that ships with OS X is great for learning, but " +"it's not good for development. The version shipped with OS X may be out " +"of date from the `official current Python release " +"`_, which is considered the " +"stable production version." +msgstr "" + +#: ../../starting/install3/osx.rst:25 +msgid "Doing it Right" +msgstr "" + +#: ../../starting/install3/osx.rst:27 +msgid "Let's install a real version of Python." +msgstr "" + +#: ../../starting/install3/osx.rst:29 +msgid "" +"Before installing Python, you'll need to install GCC. GCC can be obtained" +" by downloading `Xcode `_, the " +"smaller `Command Line Tools `_ " +"(must have an Apple account) or the even smaller `OSX-GCC-Installer " +"`_ package." +msgstr "" + +#: ../../starting/install3/osx.rst:36 +msgid "" +"If you already have Xcode installed, do not install OSX-GCC-Installer. In" +" combination, the software can cause issues that are difficult to " +"diagnose." +msgstr "" + +#: ../../starting/install3/osx.rst:41 +msgid "" +"If you perform a fresh install of Xcode, you will also need to add the " +"commandline tools by running ``xcode-select --install`` on the terminal." +msgstr "" + +#: ../../starting/install3/osx.rst:44 +msgid "" +"While OS X comes with a large number of Unix utilities, those familiar " +"with Linux systems will notice one key component missing: a package " +"manager. `Homebrew `_ fills this void." +msgstr "" + +#: ../../starting/install3/osx.rst:48 +msgid "" +"To `install Homebrew `_, open :file:`Terminal` " +"or your favorite OS X terminal emulator and run" +msgstr "" + +#: ../../starting/install3/osx.rst:55 +msgid "" +"The script will explain what changes it will make and prompt you before " +"the installation begins. Once you've installed Homebrew, insert the " +"Homebrew directory at the top of your :envvar:`PATH` environment " +"variable. You can do this by adding the following line at the bottom of " +"your :file:`~/.profile` file" +msgstr "" + +#: ../../starting/install3/osx.rst:65 +msgid "If you have OS X 10.12 (Sierra) or older use this line instead" +msgstr "" + +#: ../../starting/install3/osx.rst:71 +msgid "Now, we can install Python 3:" +msgstr "" + +#: ../../starting/install3/osx.rst:77 +msgid "This will take a minute or two." +msgstr "" + +#: ../../starting/install3/osx.rst:81 +msgid "Pip" +msgstr "" + +#: ../../starting/install3/osx.rst:83 +msgid "Homebrew installs ``pip`` pointing to the Homebrew'd Python 3 for you." +msgstr "" + +#: ../../starting/install3/osx.rst:88 +msgid "Working with Python 3" +msgstr "" + +#: ../../starting/install3/osx.rst:90 +msgid "" +"At this point, you have the system Python 2.7 available, potentially the " +":ref:`Homebrew version of Python 2 ` installed, and the " +"Homebrew version of Python 3 as well." +msgstr "" + +#: ../../starting/install3/osx.rst:98 ../../starting/install3/osx.rst:110 +msgid "will launch the Homebrew-installed Python 3 interpreter." +msgstr "" + +#: ../../starting/install3/osx.rst:104 +msgid "will launch the Homebrew-installed Python 2 interpreter (if any)." +msgstr "" + +#: ../../starting/install3/osx.rst:112 +msgid "" +"If the Homebrew version of Python 2 is installed then ``pip2`` will point" +" to Python 2. If the Homebrew version of Python 3 is installed then " +"``pip`` will point to Python 3." +msgstr "" + +#: ../../starting/install3/osx.rst:115 +msgid "The rest of the guide will assume that ``python`` references Python 3." +msgstr "" + +#: ../../starting/install3/osx.rst:126 +msgid "Pipenv & Virtual Environments" +msgstr "" + +#: ../../starting/install3/osx.rst:128 +msgid "" +"The next step is to install Pipenv, so you can install dependencies and " +"manage virtual environments." +msgstr "" + +#: ../../starting/install3/osx.rst:130 +msgid "" +"A Virtual Environment is a tool to keep the dependencies required by " +"different projects in separate places, by creating virtual Python " +"environments for them. It solves the \"Project X depends on version 1.x " +"but, Project Y needs 4.x\" dilemma, and keeps your global site-packages " +"directory clean and manageable." +msgstr "" + +#: ../../starting/install3/osx.rst:135 +msgid "" +"For example, you can work on a project which requires Django 1.10 while " +"also maintaining a project which requires Django 1.8." +msgstr "" + +#: ../../starting/install3/osx.rst:138 +msgid "" +"So, onward! To the :ref:`Pipenv & Virtual Environments " +"` docs!" +msgstr "" + +#: ../../starting/install3/osx.rst:142 +msgid "" +"This page is a remixed version of `another guide " +"`_, " +"which is available under the same license." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/starting/install3/win.po b/locales/zh_CN/LC_MESSAGES/starting/install3/win.po new file mode 100644 index 000000000..cc8f9afdc --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/starting/install3/win.po @@ -0,0 +1,106 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../starting/install3/win.rst:6 +msgid "Installing Python 3 on Windows" +msgstr "" + +#: ../../starting/install3/win.rst:10 +msgid "" +"First, follow the installation instructions for `Chocolatey " +"`_. It's a community system packager " +"manager for Windows 7+. (It's very much like Homebrew on OS X.)" +msgstr "" + +#: ../../starting/install3/win.rst:13 +msgid "" +"Once done, installing Python 3 is very simple, because Chocolatey pushes " +"Python 3 as the default." +msgstr "" + +#: ../../starting/install3/win.rst:19 +msgid "" +"Once you've run this command, you should be able to launch Python " +"directly from to the console. (Chocolatey is fantastic and automatically " +"adds Python to your path.)" +msgstr "" + +#: ../../starting/install3/win.rst:25 +msgid "Setuptools + Pip" +msgstr "" + +#: ../../starting/install3/win.rst:27 +msgid "" +"The two most crucial third-party Python packages are `setuptools " +"`_ and `pip " +"`_, which let you download, install and " +"uninstall any compliant Python software product with a single command. It" +" also enables you to add this network installation capability to your own" +" Python software with very little work." +msgstr "" + +#: ../../starting/install3/win.rst:32 +msgid "" +"All supported versions of Python 3 include pip, so just make sure it's up" +" to date:" +msgstr "" + +#: ../../starting/install3/win.rst:41 +msgid "Pipenv & Virtual Environments" +msgstr "" + +#: ../../starting/install3/win.rst:43 +msgid "" +"The next step is to install Pipenv, so you can install dependencies and " +"manage virtual environments." +msgstr "" + +#: ../../starting/install3/win.rst:45 +msgid "" +"A Virtual Environment is a tool to keep the dependencies required by " +"different projects in separate places, by creating virtual Python " +"environments for them. It solves the \"Project X depends on version 1.x " +"but, Project Y needs 4.x\" dilemma, and keeps your global site-packages " +"directory clean and manageable." +msgstr "" + +#: ../../starting/install3/win.rst:50 +msgid "" +"For example, you can work on a project which requires Django 2.0 while " +"also maintaining a project which requires Django 1.8." +msgstr "" + +#: ../../starting/install3/win.rst:53 +msgid "" +"So, onward! To the :ref:`Pipenv & Virtual Environments " +"` docs!" +msgstr "" + +#: ../../starting/install3/win.rst:57 +msgid "" +"This page is a remixed version of `another guide " +"`_, " +"which is available under the same license." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/starting/installation.po b/locales/zh_CN/LC_MESSAGES/starting/installation.po new file mode 100644 index 000000000..55ef467eb --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/starting/installation.po @@ -0,0 +1,96 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../starting/installation.rst:6 +msgid "Properly Installing Python" +msgstr "" + +#: ../../starting/installation.rst:10 +msgid "" +"There's a good chance that you already have Python on your operating " +"system." +msgstr "" + +#: ../../starting/installation.rst:12 +msgid "" +"If so, you do not need to install or configure anything else to use " +"Python. Having said that, I would strongly recommend that you install the" +" tools and libraries described in the guides below before you start " +"building Python applications for real-world use. In particular, you " +"should always install Setuptools, Pip, and Virtualenv — they make it much" +" easier for you to use other third-party Python libraries." +msgstr "" + +#: ../../starting/installation.rst:19 +msgid "" +"The use of **Python 3** is *highly* preferred over Python 2. Consider " +"upgrading your applications and infrastructure if you find yourself " +"*still* using Python 2 in production today. If you are using Python 3, " +"congratulations — you are indeed a person of excellent taste. —*Kenneth " +"Reitz*" +msgstr "" + +#: ../../starting/installation.rst:24 +msgid "Installation Guides" +msgstr "" + +#: ../../starting/installation.rst:26 +msgid "" +"These guides go over the proper installation of :ref:`Python ` for development purposes, as well as setuptools, pip and " +"virtualenv." +msgstr "" + +#: ../../starting/installation.rst:30 +msgid "Python 3 Installation Guides" +msgstr "" + +#: ../../starting/installation.rst:32 +msgid ":ref:`Python 3 on MacOS `." +msgstr "" + +#: ../../starting/installation.rst:33 +msgid ":ref:`Python 3 on Windows `." +msgstr "" + +#: ../../starting/installation.rst:34 +msgid ":ref:`Python 3 on Linux `." +msgstr "" + +#: ../../starting/installation.rst:37 +msgid "Legacy Python 2 Installation Guides" +msgstr "" + +#: ../../starting/installation.rst:39 +msgid ":ref:`Python 2 on MacOS `." +msgstr "" + +#: ../../starting/installation.rst:40 +msgid ":ref:`Python 2 on Microsoft Windows `." +msgstr "" + +#: ../../starting/installation.rst:41 +msgid ":ref:`Python 2 on Linux `." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/starting/which-python.po b/locales/zh_CN/LC_MESSAGES/starting/which-python.po new file mode 100644 index 000000000..11fcc1d6a --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/starting/which-python.po @@ -0,0 +1,287 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../starting/which-python.rst:5 +msgid "Picking a Python Interpreter (3 vs 2)" +msgstr "" + +#: ../../starting/which-python.rst:14 +msgid "The State of Python (3 & 2)" +msgstr "" + +#: ../../starting/which-python.rst:16 +msgid "" +"When choosing a Python interpreter, one looming question is always " +"present: \"Should I choose Python 2 or Python 3\"? The answer is a bit " +"more subtle than one might think." +msgstr "" + +#: ../../starting/which-python.rst:21 +msgid "The basic gist of the state of things is as follows:" +msgstr "" + +#: ../../starting/which-python.rst:23 +msgid "Most production applications today use Python 3." +msgstr "" + +#: ../../starting/which-python.rst:24 +msgid "Python 3 is ready for the production deployment of applications today." +msgstr "" + +#: ../../starting/which-python.rst:25 +msgid "Python 2 reached the end of its life on January 1, 2020 [#pep373_eol]_." +msgstr "" + +#: ../../starting/which-python.rst:26 +msgid "The brand name \"Python\" encapsulates both Python 3 and Python 2." +msgstr "" + +#: ../../starting/which-python.rst:31 +msgid "Recommendations" +msgstr "" + +#: ../../starting/which-python.rst:34 +msgid "" +"The use of **Python 3** is *highly* recommended over Python 2. Consider " +"upgrading your applications and infrastructure if you find yourself " +"*still* using Python 2 in production today. If you are using Python 3, " +"congratulations — you are indeed a person of excellent taste. —*Kenneth " +"Reitz*" +msgstr "" + +#: ../../starting/which-python.rst:37 +msgid "I'll be blunt:" +msgstr "" + +#: ../../starting/which-python.rst:39 +msgid "Use Python 3 for new Python applications." +msgstr "" + +#: ../../starting/which-python.rst:40 +msgid "" +"If you're learning Python for the first time, familiarizing yourself with" +" Python 2.7 will be very useful, but not more useful than learning Python" +" 3." +msgstr "" + +#: ../../starting/which-python.rst:42 +msgid "Learn both. They are both \"Python\"." +msgstr "" + +#: ../../starting/which-python.rst:47 +msgid "So.... 3?" +msgstr "" + +#: ../../starting/which-python.rst:49 +msgid "" +"If you're choosing a Python interpreter to use, I recommend you use the " +"newest Python 3.x, since every version brings new and improved standard " +"library modules, security and bug fixes." +msgstr "" + +#: ../../starting/which-python.rst:53 +msgid "" +"Given such, only use Python 2 if you have a strong reason to, such as a " +"pre-existing code-base, a Python 2 exclusive library, " +"simplicity/familiarity, or, of course, you absolutely love and are " +"inspired by Python 2. No harm in that." +msgstr "" + +#: ../../starting/which-python.rst:58 +msgid "`Further Reading `_" +msgstr "" + +#: ../../starting/which-python.rst:60 +msgid "" +"It is possible to `write code that works on Python 2.6, 2.7, and Python 3" +" `_. This ranges from " +"trivial to hard depending upon the kind of software you are writing; if " +"you're a beginner there are far more important things to worry about." +msgstr "" + +#: ../../starting/which-python.rst:69 +msgid "Implementations" +msgstr "" + +#: ../../starting/which-python.rst:71 +msgid "" +"When people speak of *Python* they often mean not just the language but " +"also the CPython implementation. *Python* is actually a specification for" +" a language that can be implemented in many different ways." +msgstr "" + +#: ../../starting/which-python.rst:76 +msgid "CPython" +msgstr "" + +#: ../../starting/which-python.rst:78 +msgid "" +"`CPython `_ is the reference implementation of " +"Python, written in C. It compiles Python code to intermediate bytecode " +"which is then interpreted by a virtual machine. CPython provides the " +"highest level of compatibility with Python packages and C extension " +"modules." +msgstr "" + +#: ../../starting/which-python.rst:83 +msgid "" +"If you are writing open source Python code and want to reach the widest " +"possible audience, targeting CPython is best. To use packages which rely " +"on C extensions to function, CPython is your only implementation option." +msgstr "" + +#: ../../starting/which-python.rst:87 +msgid "" +"All versions of the Python language are implemented in C because CPython " +"is the reference implementation." +msgstr "" + +#: ../../starting/which-python.rst:91 +msgid "PyPy" +msgstr "" + +#: ../../starting/which-python.rst:93 +msgid "" +"`PyPy `_ is a Python interpreter implemented in a " +"restricted statically-typed subset of the Python language called RPython." +" The interpreter features a just-in-time compiler and supports multiple " +"back-ends (C, CLI, JVM)." +msgstr "" + +#: ../../starting/which-python.rst:97 +msgid "" +"PyPy aims for maximum compatibility with the reference CPython " +"implementation while improving performance." +msgstr "" + +#: ../../starting/which-python.rst:100 +msgid "" +"If you are looking to increase performance of your Python code, it's " +"worth giving PyPy a try. On a suite of benchmarks, it's currently `over 5" +" times faster than CPython `_." +msgstr "" + +#: ../../starting/which-python.rst:104 +msgid "" +"PyPy supports Python 2.7. PyPy3 [#pypy_ver]_, released in beta, targets " +"Python 3." +msgstr "" + +#: ../../starting/which-python.rst:107 +msgid "Jython" +msgstr "" + +#: ../../starting/which-python.rst:109 +msgid "" +"`Jython `_ is a Python implementation that " +"compiles Python code to Java bytecode which is then executed by the JVM " +"(Java Virtual Machine). Additionally, it is able to import and use any " +"Java class like a Python module." +msgstr "" + +#: ../../starting/which-python.rst:114 +msgid "" +"If you need to interface with an existing Java codebase or have other " +"reasons to need to write Python code for the JVM, Jython is the best " +"choice." +msgstr "" + +#: ../../starting/which-python.rst:117 +msgid "Jython currently supports up to Python 2.7. [#jython_ver]_" +msgstr "" + +#: ../../starting/which-python.rst:120 +msgid "IronPython" +msgstr "" + +#: ../../starting/which-python.rst:122 +msgid "" +"`IronPython `_ is an implementation of Python " +"for the .NET framework. It can use both Python and .NET framework " +"libraries, and can also expose Python code to other languages in the .NET" +" framework." +msgstr "" + +#: ../../starting/which-python.rst:126 +msgid "" +"`Python Tools for Visual Studio `_ " +"integrates IronPython directly into the Visual Studio development " +"environment, making it an ideal choice for Windows developers." +msgstr "" + +#: ../../starting/which-python.rst:130 +msgid "" +"IronPython supports Python 2.7. [#iron_ver]_ IronPython 3 [#iron_ver3]_ " +"is being developed, but is not ready for use as of September 2020." +msgstr "" + +#: ../../starting/which-python.rst:134 +msgid "PythonNet" +msgstr "" + +#: ../../starting/which-python.rst:136 +msgid "" +"`Python for .NET `_ is a package which " +"provides near seamless integration of a natively installed Python " +"installation with the .NET Common Language Runtime (CLR). This is the " +"inverse approach to that taken by IronPython (see above), to which it is " +"more complementary than competing with." +msgstr "" + +#: ../../starting/which-python.rst:142 +msgid "" +"In conjunction with Mono, pythonnet enables native Python installations " +"on non-Windows operating systems, such as OS X and Linux, to operate " +"within the .NET framework. It can be run in addition to IronPython " +"without conflict." +msgstr "" + +#: ../../starting/which-python.rst:147 +msgid "Pythonnet is compatible with Python 2.7 and 3.5-3.8. [#pythonnet_ver1]_" +msgstr "" + +#: ../../starting/which-python.rst:149 +msgid "https://pypy.org/compat.html" +msgstr "" + +#: ../../starting/which-python.rst:151 +msgid "https://hg.python.org/jython/file/412a8f9445f7/NEWS" +msgstr "" + +#: ../../starting/which-python.rst:153 +msgid "https://ironpython.net/download/" +msgstr "" + +#: ../../starting/which-python.rst:155 +msgid "https://github.com/IronLanguages/ironpython3" +msgstr "" + +#: ../../starting/which-python.rst:157 +msgid "https://pythonnet.github.io/" +msgstr "" + +#: ../../starting/which-python.rst:159 +msgid "https://www.python.org/dev/peps/pep-0373/#id2" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/writing/documentation.po b/locales/zh_CN/LC_MESSAGES/writing/documentation.po new file mode 100644 index 000000000..69d85c75e --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/writing/documentation.po @@ -0,0 +1,363 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../writing/documentation.rst:5 +msgid "Documentation" +msgstr "" + +#: ../../writing/documentation.rst:9 +msgid "" +"Readability is a primary focus for Python developers, in both project and" +" code documentation. Following some simple best practices can save both " +"you and others a lot of time." +msgstr "" + +#: ../../writing/documentation.rst:16 +msgid "Project Documentation" +msgstr "" + +#: ../../writing/documentation.rst:18 +msgid "" +"A :file:`README` file at the root directory should give general " +"information to both users and maintainers of a project. It should be raw " +"text or written in some very easy to read markup, such as :ref" +":`reStructuredText-ref` or Markdown. It should contain a few lines " +"explaining the purpose of the project or library (without assuming the " +"user knows anything about the project), the URL of the main source for " +"the software, and some basic credit information. This file is the main " +"entry point for readers of the code." +msgstr "" + +#: ../../writing/documentation.rst:26 +msgid "" +"An :file:`INSTALL` file is less necessary with Python. The installation " +"instructions are often reduced to one command, such as ``pip install " +"module`` or ``python setup.py install``, and added to the :file:`README` " +"file." +msgstr "" + +#: ../../writing/documentation.rst:31 +msgid "" +"A :file:`LICENSE` file should *always* be present and specify the license" +" under which the software is made available to the public." +msgstr "" + +#: ../../writing/documentation.rst:34 +msgid "" +"A :file:`TODO` file or a ``TODO`` section in :file:`README` should list " +"the planned development for the code." +msgstr "" + +#: ../../writing/documentation.rst:37 +msgid "" +"A :file:`CHANGELOG` file or section in :file:`README` should compile a " +"short overview of the changes in the code base for the latest versions." +msgstr "" + +#: ../../writing/documentation.rst:43 +msgid "Project Publication" +msgstr "" + +#: ../../writing/documentation.rst:45 +msgid "" +"Depending on the project, your documentation might include some or all of" +" the following components:" +msgstr "" + +#: ../../writing/documentation.rst:48 +msgid "" +"An *introduction* should give a very short overview of what can be done " +"with the product, using one or two extremely simplified use cases. This " +"is the thirty-second pitch for your project." +msgstr "" + +#: ../../writing/documentation.rst:52 +msgid "" +"A *tutorial* should show some primary use cases in more detail. The " +"reader will follow a step-by-step procedure to set-up a working " +"prototype." +msgstr "" + +#: ../../writing/documentation.rst:55 +msgid "" +"An *API reference* is typically generated from the code (see " +":ref:`docstrings `). It will list all publicly available " +"interfaces, parameters, and return values." +msgstr "" + +#: ../../writing/documentation.rst:59 +msgid "" +"*Developer documentation* is intended for potential contributors. This " +"can include code convention and general design strategy of the project." +msgstr "" + +#: ../../writing/documentation.rst:65 +msgid "Sphinx" +msgstr "" + +#: ../../writing/documentation.rst:67 +msgid "" +"Sphinx_ is far and away the most popular Python documentation tool. **Use" +" it.** It converts :ref:`restructuredtext-ref` markup language into a " +"range of output formats including HTML, LaTeX (for printable PDF " +"versions), manual pages, and plain text." +msgstr "" + +#: ../../writing/documentation.rst:72 +msgid "" +"There is also **great**, **free** hosting for your Sphinx_ docs: `Read " +"The Docs`_. Use it. You can configure it with commit hooks to your source" +" repository so that rebuilding your documentation will happen " +"automatically." +msgstr "" + +#: ../../writing/documentation.rst:77 +msgid "" +"When run, Sphinx_ will import your code and using Python's introspection " +"features it will extract all function, method, and class signatures. It " +"will also extract the accompanying docstrings, and compile it all into " +"well structured and easily readable documentation for your project." +msgstr "" + +#: ../../writing/documentation.rst:84 +msgid "" +"Sphinx is famous for its API generation, but it also works well for " +"general project documentation. This Guide is built with Sphinx_ and is " +"hosted on `Read The Docs`_" +msgstr "" + +#: ../../writing/documentation.rst:94 +msgid "reStructuredText" +msgstr "" + +#: ../../writing/documentation.rst:96 +msgid "" +"Most Python documentation is written with reStructuredText_. It's like " +"Markdown, but with all the optional extensions built in." +msgstr "" + +#: ../../writing/documentation.rst:99 +msgid "" +"The `reStructuredText Primer`_ and the `reStructuredText Quick " +"Reference`_ should help you familiarize yourself with its syntax." +msgstr "" + +#: ../../writing/documentation.rst:109 +msgid "Code Documentation Advice" +msgstr "" + +#: ../../writing/documentation.rst:111 +msgid "" +"Comments clarify the code and they are added with purpose of making the " +"code easier to understand. In Python, comments begin with a hash (number " +"sign) (``#``)." +msgstr "" + +#: ../../writing/documentation.rst:117 +msgid "In Python, *docstrings* describe modules, classes, and functions:" +msgstr "" + +#: ../../writing/documentation.rst:125 +msgid "" +"In general, follow the comment section of :pep:`8#comments` (the \"Python" +" Style Guide\"). More information about docstrings can be found at " +":pep:`0257#specification` (The Docstring Conventions Guide)." +msgstr "" + +#: ../../writing/documentation.rst:129 +msgid "Commenting Sections of Code" +msgstr "" + +#: ../../writing/documentation.rst:131 +msgid "" +"*Do not use triple-quote strings to comment code*. This is not a good " +"practice, because line-oriented command-line tools such as grep will not " +"be aware that the commented code is inactive. It is better to add hashes " +"at the proper indentation level for every commented line. Your editor " +"probably has the ability to do this easily, and it is worth learning the " +"comment/uncomment toggle." +msgstr "" + +#: ../../writing/documentation.rst:139 +msgid "Docstrings and Magic" +msgstr "" + +#: ../../writing/documentation.rst:141 +msgid "" +"Some tools use docstrings to embed more-than-documentation behavior, such" +" as unit test logic. Those can be nice, but you won't ever go wrong with " +"vanilla \"here's what this does.\"" +msgstr "" + +#: ../../writing/documentation.rst:145 +msgid "" +"Tools like Sphinx_ will parse your docstrings as reStructuredText and " +"render it correctly as HTML. This makes it very easy to embed snippets of" +" example code in a project's documentation." +msgstr "" + +#: ../../writing/documentation.rst:149 +msgid "" +"Additionally, Doctest_ will read all embedded docstrings that look like " +"input from the Python commandline (prefixed with \">>>\") and run them, " +"checking to see if the output of the command matches the text on the " +"following line. This allows developers to embed real examples and usage " +"of functions alongside their source code. As a side effect, it also " +"ensures that their code is tested and works." +msgstr "" + +#: ../../writing/documentation.rst:170 +msgid "Docstrings versus Block comments" +msgstr "" + +#: ../../writing/documentation.rst:172 +msgid "" +"These aren't interchangeable. For a function or class, the leading " +"comment block is a programmer's note. The docstring describes the " +"*operation* of the function or class:" +msgstr "" + +#: ../../writing/documentation.rst:183 +msgid "" +"Unlike block comments, docstrings are built into the Python language " +"itself. This means you can use all of Python's powerful introspection " +"capabilities to access docstrings at runtime, compared with comments " +"which are optimized out. Docstrings are accessible from both the " +"`__doc__` dunder attribute for almost every Python object, as well as " +"with the built in `help()` function." +msgstr "" + +#: ../../writing/documentation.rst:189 +msgid "" +"While block comments are usually used to explain *what* a section of code" +" is doing, or the specifics of an algorithm, docstrings are more intended" +" towards explaining other users of your code (or you in 6 months time) " +"*how* a particular function can be used and the general purpose of a " +"function, class, or module." +msgstr "" + +#: ../../writing/documentation.rst:196 +msgid "Writing Docstrings" +msgstr "" + +#: ../../writing/documentation.rst:198 +msgid "" +"Depending on the complexity of the function, method, or class being " +"written, a one-line docstring may be perfectly appropriate. These are " +"generally used for really obvious cases, such as::" +msgstr "" + +#: ../../writing/documentation.rst:206 +msgid "" +"The docstring should describe the function in a way that is easy to " +"understand. For simple cases like trivial functions and classes, simply " +"embedding the function's signature (i.e. `add(a, b) -> result`) in the " +"docstring is unnecessary. This is because with Python's `inspect` module," +" it is already quite easy to find this information if needed, and it is " +"also readily available by reading the source code." +msgstr "" + +#: ../../writing/documentation.rst:213 +msgid "" +"In larger or more complex projects however, it is often a good idea to " +"give more information about a function, what it does, any exceptions it " +"may raise, what it returns, or relevant details about the parameters." +msgstr "" + +#: ../../writing/documentation.rst:217 +msgid "" +"For more detailed documentation of code a popular style used, is the one " +"used by the NumPy project, often called `NumPy style`_ docstrings. While " +"it can take up more lines than the previous example, it allows the " +"developer to include a lot more information about a method, function, or " +"class. ::" +msgstr "" + +#: ../../writing/documentation.rst:243 +msgid "" +"The `sphinx.ext.napoleon`_ plugin allows Sphinx to parse this style of " +"docstrings, making it easy to incorporate NumPy style docstrings into " +"your project." +msgstr "" + +#: ../../writing/documentation.rst:247 +msgid "" +"At the end of the day, it doesn't really matter what style is used for " +"writing docstrings; their purpose is to serve as documentation for anyone" +" who may need to read or make changes to your code. As long as it is " +"correct, understandable, and gets the relevant points across then it has " +"done the job it was designed to do." +msgstr "" + +#: ../../writing/documentation.rst:254 +msgid "For further reading on docstrings, feel free to consult :pep:`257`" +msgstr "" + +#: ../../writing/documentation.rst:263 +msgid "Other Tools" +msgstr "" + +#: ../../writing/documentation.rst:265 +msgid "You might see these in the wild. Use :ref:`sphinx-ref`." +msgstr "" + +#: ../../writing/documentation.rst:270 +msgid "Pycco_" +msgstr "" + +#: ../../writing/documentation.rst:268 +msgid "" +"Pycco is a \"literate-programming-style documentation generator\" and is " +"a port of the node.js Docco_. It makes code into a side-by-side HTML code" +" and documentation." +msgstr "" + +#: ../../writing/documentation.rst:277 +msgid "Ronn_" +msgstr "" + +#: ../../writing/documentation.rst:276 +msgid "" +"Ronn builds Unix manuals. It converts human readable textfiles to roff " +"for terminal display, and also to HTML for the web." +msgstr "" + +#: ../../writing/documentation.rst:282 +msgid "Epydoc_" +msgstr "" + +#: ../../writing/documentation.rst:282 +msgid "Epydoc is discontinued. Use :ref:`sphinx-ref` instead." +msgstr "" + +#: ../../writing/documentation.rst:288 +msgid "MkDocs_" +msgstr "" + +#: ../../writing/documentation.rst:287 +msgid "" +"MkDocs is a fast and simple static site generator that's geared towards " +"building project documentation with Markdown." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/writing/gotchas.po b/locales/zh_CN/LC_MESSAGES/writing/gotchas.po new file mode 100644 index 000000000..1735cb22d --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/writing/gotchas.po @@ -0,0 +1,268 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../writing/gotchas.rst:5 +msgid "Common Gotchas" +msgstr "" + +#: ../../writing/gotchas.rst:9 +msgid "" +"For the most part, Python aims to be a clean and consistent language that" +" avoids surprises. However, there are a few cases that can be confusing " +"for newcomers." +msgstr "" + +#: ../../writing/gotchas.rst:13 +msgid "" +"Some of these cases are intentional but can be potentially surprising. " +"Some could arguably be considered language warts. In general, what " +"follows is a collection of potentially tricky behavior that might seem " +"strange at first glance, but are generally sensible, once you're aware of" +" the underlying cause for the surprise." +msgstr "" + +#: ../../writing/gotchas.rst:25 +msgid "Mutable Default Arguments" +msgstr "" + +#: ../../writing/gotchas.rst:27 +msgid "" +"Seemingly the *most* common surprise new Python programmers encounter is " +"Python's treatment of mutable default arguments in function definitions." +msgstr "" + +#: ../../writing/gotchas.rst:31 ../../writing/gotchas.rst:105 +msgid "What You Wrote" +msgstr "" + +#: ../../writing/gotchas.rst:40 ../../writing/gotchas.rst:113 +msgid "What You Might Have Expected to Happen" +msgstr "" + +#: ../../writing/gotchas.rst:50 +msgid "" +"A new list is created each time the function is called if a second " +"argument isn't provided, so that the output is::" +msgstr "" + +#: ../../writing/gotchas.rst:57 ../../writing/gotchas.rst:130 +msgid "What Actually Happens" +msgstr "" + +#: ../../writing/gotchas.rst:64 +msgid "" +"A new list is created *once* when the function is defined, and the same " +"list is used in each successive call." +msgstr "" + +#: ../../writing/gotchas.rst:67 +msgid "" +"Python's default arguments are evaluated *once* when the function is " +"defined, not each time the function is called (like it is in say, Ruby). " +"This means that if you use a mutable default argument and mutate it, you " +"*will* and have mutated that object for all future calls to the function " +"as well." +msgstr "" + +#: ../../writing/gotchas.rst:73 ../../writing/gotchas.rst:169 +msgid "What You Should Do Instead" +msgstr "" + +#: ../../writing/gotchas.rst:75 +msgid "" +"Create a new object each time the function is called, by using a default " +"arg to signal that no argument was provided (:py:data:`None` is often a " +"good choice)." +msgstr "" + +#: ../../writing/gotchas.rst:86 +msgid "Do not forget, you are passing a *list* object as the second argument." +msgstr "" + +#: ../../writing/gotchas.rst:89 ../../writing/gotchas.rst:192 +msgid "When the Gotcha Isn't a Gotcha" +msgstr "" + +#: ../../writing/gotchas.rst:91 +msgid "" +"Sometimes you can specifically \"exploit\" (read: use as intended) this " +"behavior to maintain state between calls of a function. This is often " +"done when writing a caching function." +msgstr "" + +#: ../../writing/gotchas.rst:98 +msgid "Late Binding Closures" +msgstr "" + +#: ../../writing/gotchas.rst:100 +msgid "" +"Another common source of confusion is the way Python binds its variables " +"in closures (or in the surrounding global scope)." +msgstr "" + +#: ../../writing/gotchas.rst:120 +msgid "" +"A list containing five functions that each have their own closed-over " +"``i`` variable that multiplies their argument, producing::" +msgstr "" + +#: ../../writing/gotchas.rst:140 +msgid "Five functions are created; instead all of them just multiply ``x`` by 4." +msgstr "" + +#: ../../writing/gotchas.rst:142 +msgid "" +"Python's closures are *late binding*. This means that the values of " +"variables used in closures are looked up at the time the inner function " +"is called." +msgstr "" + +#: ../../writing/gotchas.rst:146 +msgid "" +"Here, whenever *any* of the returned functions are called, the value of " +"``i`` is looked up in the surrounding scope at call time. By then, the " +"loop has completed and ``i`` is left with its final value of 4." +msgstr "" + +#: ../../writing/gotchas.rst:150 +msgid "" +"What's particularly nasty about this gotcha is the seemingly prevalent " +"misinformation that this has something to do with :ref:`lambdas " +"` in Python. Functions created with a ``lambda`` " +"expression are in no way special, and in fact the same exact behavior is " +"exhibited by just using an ordinary ``def``:" +msgstr "" + +#: ../../writing/gotchas.rst:171 +msgid "" +"The most general solution is arguably a bit of a hack. Due to Python's " +"aforementioned behavior concerning evaluating default arguments to " +"functions (see :ref:`default_args`), you can create a closure that binds " +"immediately to its arguments by using a default arg like so:" +msgstr "" + +#: ../../writing/gotchas.rst:181 +msgid "Alternatively, you can use the functools.partial function:" +msgstr "" + +#: ../../writing/gotchas.rst:194 +msgid "" +"Sometimes you want your closures to behave this way. Late binding is good" +" in lots of situations. Looping to create unique functions is " +"unfortunately a case where they can cause hiccups." +msgstr "" + +#: ../../writing/gotchas.rst:201 +msgid "Bytecode (.pyc) Files Everywhere!" +msgstr "" + +#: ../../writing/gotchas.rst:203 +msgid "" +"By default, when executing Python code from files, the Python interpreter" +" will automatically write a bytecode version of that file to disk, e.g. " +"``module.pyc``." +msgstr "" + +#: ../../writing/gotchas.rst:207 +msgid "" +"These ``.pyc`` files should not be checked into your source code " +"repositories." +msgstr "" + +#: ../../writing/gotchas.rst:209 +msgid "" +"Theoretically, this behavior is on by default for performance reasons. " +"Without these bytecode files, Python would re-generate the bytecode every" +" time the file is loaded." +msgstr "" + +#: ../../writing/gotchas.rst:215 +msgid "Disabling Bytecode (.pyc) Files" +msgstr "" + +#: ../../writing/gotchas.rst:217 +msgid "" +"Luckily, the process of generating the bytecode is extremely fast, and " +"isn't something you need to worry about while developing your code." +msgstr "" + +#: ../../writing/gotchas.rst:220 +msgid "Those files are annoying, so let's get rid of them!" +msgstr "" + +#: ../../writing/gotchas.rst:226 +msgid "" +"With the ``$PYTHONDONTWRITEBYTECODE`` environment variable set, Python " +"will no longer write these files to disk, and your development " +"environment will remain nice and clean." +msgstr "" + +#: ../../writing/gotchas.rst:230 +msgid "I recommend setting this environment variable in your ``~/.profile``." +msgstr "" + +#: ../../writing/gotchas.rst:233 +msgid "Removing Bytecode (.pyc) Files" +msgstr "" + +#: ../../writing/gotchas.rst:235 +msgid "Here's nice trick for removing all of these files, if they already exist::" +msgstr "" + +#: ../../writing/gotchas.rst:239 +msgid "" +"Run that from the root directory of your project, and all ``.pyc`` files " +"will suddenly vanish. Much better." +msgstr "" + +#: ../../writing/gotchas.rst:245 +msgid "Version Control Ignores" +msgstr "" + +#: ../../writing/gotchas.rst:247 +msgid "" +"If you still need the ``.pyc`` files for performance reasons, you can " +"always add them to the ignore files of your version control repositories." +" Popular version control systems have the ability to use wildcards " +"defined in a file to apply special rules." +msgstr "" + +#: ../../writing/gotchas.rst:252 +msgid "" +"An ignore file will make sure the matching files don't get checked into " +"the repository. Git_ uses ``.gitignore`` while Mercurial_ uses " +"``.hgignore``." +msgstr "" + +#: ../../writing/gotchas.rst:258 +msgid "At the minimum your ignore files should look like this." +msgstr "" + +#: ../../writing/gotchas.rst:266 +msgid "" +"You may wish to include more files and directories depending on your " +"needs. The next time you commit to the repository, these files will not " +"be included." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/writing/license.po b/locales/zh_CN/LC_MESSAGES/writing/license.po new file mode 100644 index 000000000..4a946becd --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/writing/license.po @@ -0,0 +1,132 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../writing/license.rst:5 +msgid "Choosing a License" +msgstr "" + +#: ../../writing/license.rst:9 +msgid "" +"Your source publication *needs* a license. In the US, unless a license is" +" specified, users have no legal right to download, modify, or distribute " +"the product. Furthermore, people can't contribute to your code unless you" +" tell them what rules to play by. Choosing a license is complicated, so " +"here are some pointers:" +msgstr "" + +#: ../../writing/license.rst:14 +msgid "" +"Open source. There are plenty of `open source licenses " +"`_ available to choose from." +msgstr "" + +#: ../../writing/license.rst:18 +msgid "In general, these licenses tend to fall into one of two categories:" +msgstr "" + +#: ../../writing/license.rst:20 +msgid "" +"licenses that focus more on the user's freedom to do with the software as" +" they please (these are the more permissive open source licenses such as " +"the MIT, BSD, and Apache)" +msgstr "" + +#: ../../writing/license.rst:24 +msgid "" +"licenses that focus more on making sure that the code itself — including " +"any changes made to it and distributed along with it — always remains " +"free (these are the less permissive free software licenses such as the " +"GPL and LGPL)" +msgstr "" + +#: ../../writing/license.rst:29 +msgid "" +"The latter are less permissive in the sense that they don't permit " +"someone to add code to the software and distribute it without also " +"including the source code for their changes." +msgstr "" + +#: ../../writing/license.rst:33 +msgid "" +"To help you choose one for your project, there's a `license chooser " +"`_; **use it**." +msgstr "" + +#: ../../writing/license.rst:36 +msgid "**More Permissive**" +msgstr "" + +#: ../../writing/license.rst:38 +msgid "" +"PSFL (Python Software Foundation License) -- for contributing to Python " +"itself" +msgstr "" + +#: ../../writing/license.rst:39 +msgid "MIT / BSD / ISC" +msgstr "" + +#: ../../writing/license.rst:41 +msgid "MIT (X11)" +msgstr "" + +#: ../../writing/license.rst:42 +msgid "New BSD" +msgstr "" + +#: ../../writing/license.rst:43 +msgid "ISC" +msgstr "" + +#: ../../writing/license.rst:45 +msgid "Apache" +msgstr "" + +#: ../../writing/license.rst:47 +msgid "**Less Permissive:**" +msgstr "" + +#: ../../writing/license.rst:49 +msgid "LGPL" +msgstr "" + +#: ../../writing/license.rst:50 +msgid "GPL" +msgstr "" + +#: ../../writing/license.rst:52 +msgid "GPLv2" +msgstr "" + +#: ../../writing/license.rst:53 +msgid "GPLv3" +msgstr "" + +#: ../../writing/license.rst:55 +msgid "" +"A good overview of licenses with explanations of what one can, cannot, " +"and must do using a particular software can be found at `tl;drLegal " +"`_." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/writing/logging.po b/locales/zh_CN/LC_MESSAGES/writing/logging.po new file mode 100644 index 000000000..51dd662bc --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/writing/logging.po @@ -0,0 +1,215 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../writing/logging.rst:5 +msgid "Logging" +msgstr "" + +#: ../../writing/logging.rst:9 +msgid "" +"The :mod:`logging` module has been a part of Python's Standard Library " +"since version 2.3. It is succinctly described in :pep:`282`. The " +"documentation is notoriously hard to read, except for the `basic logging " +"tutorial`_." +msgstr "" + +#: ../../writing/logging.rst:13 +msgid "" +"As an alternative, `loguru `_ provides " +"an approach for logging, nearly as simple as using a simple ``print`` " +"statement." +msgstr "" + +#: ../../writing/logging.rst:15 +msgid "Logging serves two purposes:" +msgstr "" + +#: ../../writing/logging.rst:17 +msgid "" +"**Diagnostic logging** records events related to the application's " +"operation. If a user calls in to report an error, for example, the logs " +"can be searched for context." +msgstr "" + +#: ../../writing/logging.rst:20 +msgid "" +"**Audit logging** records events for business analysis. A user's " +"transactions can be extracted and combined with other user details for " +"reports or to optimize a business goal." +msgstr "" + +#: ../../writing/logging.rst:27 +msgid "... or Print?" +msgstr "" + +#: ../../writing/logging.rst:29 +msgid "" +"The only time that ``print`` is a better option than logging is when the " +"goal is to display a help statement for a command line application. Other" +" reasons why logging is better than ``print``:" +msgstr "" + +#: ../../writing/logging.rst:33 +msgid "" +"The `log record`_, which is created with every logging event, contains " +"readily available diagnostic information such as the file name, full " +"path, function, and line number of the logging event." +msgstr "" + +#: ../../writing/logging.rst:36 +msgid "" +"Events logged in included modules are automatically accessible via the " +"root logger to your application's logging stream, unless you filter them " +"out." +msgstr "" + +#: ../../writing/logging.rst:38 +msgid "" +"Logging can be selectively silenced by using the method " +":meth:`logging.Logger.setLevel` or disabled by setting the attribute " +":attr:`logging.Logger.disabled` to ``True``." +msgstr "" + +#: ../../writing/logging.rst:45 +msgid "Logging in a Library" +msgstr "" + +#: ../../writing/logging.rst:47 +msgid "" +"Notes for `configuring logging for a library`_ are in the `logging " +"tutorial`_. Because the *user*, not the library, should dictate what " +"happens when a logging event occurs, one admonition bears repeating:" +msgstr "" + +#: ../../writing/logging.rst:53 +msgid "" +"It is strongly advised that you do not add any handlers other than " +"NullHandler to your library’s loggers." +msgstr "" + +#: ../../writing/logging.rst:57 +msgid "" +"Best practice when instantiating loggers in a library is to only create " +"them using the ``__name__`` global variable: the :mod:`logging` module " +"creates a hierarchy of loggers using dot notation, so using ``__name__`` " +"ensures no name collisions." +msgstr "" + +#: ../../writing/logging.rst:62 +msgid "" +"Here is an example of the best practice from the `requests source`_ -- " +"place this in your ``__init__.py``:" +msgstr "" + +#: ../../writing/logging.rst:73 +msgid "Logging in an Application" +msgstr "" + +#: ../../writing/logging.rst:75 +msgid "" +"The `twelve factor app `_, an authoritative " +"reference for good practice in application development, contains a " +"section on `logging best practice `_. It " +"emphatically advocates for treating log events as an event stream, and " +"for sending that event stream to standard output to be handled by the " +"application environment." +msgstr "" + +#: ../../writing/logging.rst:83 +msgid "There are at least three ways to configure a logger:" +msgstr "" + +#: ../../writing/logging.rst:88 +msgid "Using an INI-formatted file:" +msgstr "" + +#: ../../writing/logging.rst:86 +msgid "" +"**Pro**: possible to update configuration while running, using the " +"function :func:`logging.config.listen` to listen on a socket." +msgstr "" + +#: ../../writing/logging.rst:88 +msgid "" +"**Con**: less control (e.g. custom subclassed filters or loggers) than " +"possible when configuring a logger in code." +msgstr "" + +#: ../../writing/logging.rst:93 +msgid "Using a dictionary or a JSON-formatted file:" +msgstr "" + +#: ../../writing/logging.rst:91 +msgid "" +"**Pro**: in addition to updating while running, it is possible to load " +"from a file using the :mod:`json` module, in the standard library since " +"Python 2.6." +msgstr "" + +#: ../../writing/logging.rst:94 +msgid "**Con**: less control than when configuring a logger in code." +msgstr "" + +#: ../../writing/logging.rst:98 +msgid "Using code:" +msgstr "" + +#: ../../writing/logging.rst:96 +msgid "**Pro**: complete control over the configuration." +msgstr "" + +#: ../../writing/logging.rst:97 +msgid "**Con**: modifications require a change to the source code." +msgstr "" + +#: ../../writing/logging.rst:101 +msgid "Example Configuration via an INI File" +msgstr "" + +#: ../../writing/logging.rst:103 +msgid "" +"Let us say that the file is named ``logging_config.ini``. More details " +"for the file format are in the `logging configuration`_ section of the " +"`logging tutorial`_." +msgstr "" + +#: ../../writing/logging.rst:132 +msgid "Then use :meth:`logging.config.fileConfig` in the code:" +msgstr "" + +#: ../../writing/logging.rst:145 +msgid "Example Configuration via a Dictionary" +msgstr "" + +#: ../../writing/logging.rst:147 +msgid "" +"As of Python 2.7, you can use a dictionary with configuration details. " +":pep:`391` contains a list of the mandatory and optional elements in the " +"configuration dictionary." +msgstr "" + +#: ../../writing/logging.rst:180 +msgid "Example Configuration Directly in Code" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/writing/reading.po b/locales/zh_CN/LC_MESSAGES/writing/reading.po new file mode 100644 index 000000000..51b204009 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/writing/reading.po @@ -0,0 +1,108 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../writing/reading.rst:5 +msgid "Reading Great Code" +msgstr "" + +#: ../../writing/reading.rst:9 +msgid "" +"One of the secrets of becoming a great Python programmer is to read, " +"understand, and comprehend excellent code." +msgstr "" + +#: ../../writing/reading.rst:12 +msgid "" +"Excellent code typically follows the guidelines outlined in " +":ref:`code_style`, and does its best to express a clear and concise " +"intent to the reader." +msgstr "" + +#: ../../writing/reading.rst:16 +msgid "" +"Included below is a list of recommended Python projects for reading. Each" +" one of these projects is a paragon of Python coding." +msgstr "" + +#: ../../writing/reading.rst:19 +msgid "" +"`Howdoi `_ Howdoi is a code search " +"tool, written in Python." +msgstr "" + +#: ../../writing/reading.rst:22 +msgid "" +"`Flask `_ Flask is a microframework " +"for Python based on Werkzeug and Jinja2. It's intended for getting " +"started very quickly and was developed with best intentions in mind." +msgstr "" + +#: ../../writing/reading.rst:27 +msgid "" +"`Diamond `_ Diamond is a " +"Python daemon that collects metrics and publishes them to Graphite or " +"other backends. It is capable of collecting CPU, memory, network, I/O, " +"load, and disk metrics. Additionally, it features an API for implementing" +" custom collectors for gathering metrics from almost any source." +msgstr "" + +#: ../../writing/reading.rst:34 +msgid "" +"`Werkzeug `_ Werkzeug started as a" +" simple collection of various utilities for WSGI applications and has " +"become one of the most advanced WSGI utility modules. It includes a " +"powerful debugger, full-featured request and response objects, HTTP " +"utilities to handle entity tags, cache control headers, HTTP dates, " +"cookie handling, file uploads, a powerful URL routing system, and a bunch" +" of community-contributed addon modules." +msgstr "" + +#: ../../writing/reading.rst:42 +msgid "" +"`Requests `_ Requests is an " +"Apache2 Licensed HTTP library, written in Python, for human beings." +msgstr "" + +#: ../../writing/reading.rst:46 +msgid "" +"`Tablib `_ Tablib is a format-" +"agnostic tabular dataset library, written in Python." +msgstr "" + +#: ../../writing/reading.rst:50 ../../writing/reading.rst:52 +msgid "待处理" +msgstr "" + +#: ../../writing/reading.rst:50 +msgid "" +"Include code examples of exemplary code from each of the projects listed." +" Explain why it is excellent code. Use complex examples." +msgstr "" + +#: ../../writing/reading.rst:52 +msgid "" +"Explain techniques to rapidly identify data structures and algorithms and" +" determine what the code is doing." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/writing/structure.po b/locales/zh_CN/LC_MESSAGES/writing/structure.po new file mode 100644 index 000000000..77d5676de --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/writing/structure.po @@ -0,0 +1,1046 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../writing/structure.rst:5 +msgid "Structuring Your Project" +msgstr "" + +#: ../../writing/structure.rst:9 +msgid "" +"By \"structure\" we mean the decisions you make concerning how your " +"project best meets its objective. We need to consider how to best " +"leverage Python's features to create clean, effective code. In practical " +"terms, \"structure\" means making clean code whose logic and dependencies" +" are clear as well as how the files and folders are organized in the " +"filesystem." +msgstr "" + +#: ../../writing/structure.rst:16 +msgid "" +"Which functions should go into which modules? How does data flow through " +"the project? What features and functions can be grouped together and " +"isolated? By answering questions like these you can begin to plan, in a " +"broad sense, what your finished product will look like." +msgstr "" + +#: ../../writing/structure.rst:21 +msgid "" +"In this section, we take a closer look at Python's modules and import " +"systems as they are the central elements to enforcing structure in your " +"project. We then discuss various perspectives on how to build code which " +"can be extended and tested reliably." +msgstr "" + +#: ../../writing/structure.rst:29 +msgid "Structure of the Repository" +msgstr "" + +#: ../../writing/structure.rst:32 +msgid "It's Important." +msgstr "" + +#: ../../writing/structure.rst:34 +msgid "" +"Just as Code Style, API Design, and Automation are essential for a " +"healthy development cycle. Repository structure is a crucial part of your" +" project's `architecture " +"`__." +msgstr "" + +#: ../../writing/structure.rst:39 +msgid "" +"When a potential user or contributor lands on your repository's page, " +"they see a few things:" +msgstr "" + +#: ../../writing/structure.rst:42 +msgid "Project Name" +msgstr "" + +#: ../../writing/structure.rst:43 +msgid "Project Description" +msgstr "" + +#: ../../writing/structure.rst:44 +msgid "Bunch O' Files" +msgstr "" + +#: ../../writing/structure.rst:46 +msgid "" +"Only when they scroll below the fold will the user see your project's " +"README." +msgstr "" + +#: ../../writing/structure.rst:49 +msgid "" +"If your repo is a massive dump of files or a nested mess of directories, " +"they might look elsewhere before even reading your beautiful " +"documentation." +msgstr "" + +#: ../../writing/structure.rst:53 +msgid "Dress for the job you want, not the job you have." +msgstr "" + +#: ../../writing/structure.rst:55 +msgid "" +"Of course, first impressions aren't everything. You and your colleagues " +"will spend countless hours working with this repository, eventually " +"becoming intimately familiar with every nook and cranny. The layout is " +"important." +msgstr "" + +#: ../../writing/structure.rst:60 +msgid "Sample Repository" +msgstr "" + +#: ../../writing/structure.rst:62 +msgid "" +"**tl;dr**: This is what `Kenneth Reitz recommended in 2013 " +"`__." +msgstr "" + +#: ../../writing/structure.rst:64 +msgid "" +"This repository is `available on GitHub " +"`__." +msgstr "" + +#: ../../writing/structure.rst:81 +msgid "Let's get into some specifics." +msgstr "" + +#: ../../writing/structure.rst:84 +msgid "The Actual Module" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "Location" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "``./sample/`` or ``./sample.py``" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "Purpose" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "The code of interest" +msgstr "" + +#: ../../writing/structure.rst:93 +msgid "" +"Your module package is the core focus of the repository. It should not be" +" tucked away:" +msgstr "" + +#: ../../writing/structure.rst:100 +msgid "" +"If your module consists of only a single file, you can place it directly " +"in the root of your repository:" +msgstr "" + +#: ../../writing/structure.rst:107 +msgid "Your library does not belong in an ambiguous src or python subdirectory." +msgstr "" + +#: ../../writing/structure.rst:110 +msgid "License" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "``./LICENSE``" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "Lawyering up." +msgstr "" + +#: ../../writing/structure.rst:120 +msgid "" +"This is arguably the most important part of your repository, aside from " +"the source code itself. The full license text and copyright claims should" +" exist in this file." +msgstr "" + +#: ../../writing/structure.rst:124 +msgid "" +"If you aren't sure which license you should use for your project, check " +"out `choosealicense.com `_." +msgstr "" + +#: ../../writing/structure.rst:127 +msgid "" +"Of course, you are also free to publish code without a license, but this " +"would prevent many people from potentially using or contributing to your " +"code." +msgstr "" + +#: ../../writing/structure.rst:131 +msgid "Setup.py" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "``./setup.py``" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "Package and distribution management." +msgstr "" + +#: ../../writing/structure.rst:140 +msgid "" +"If your module package is at the root of your repository, this should " +"obviously be at the root as well." +msgstr "" + +#: ../../writing/structure.rst:144 +msgid "Requirements File" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "``./requirements.txt``" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "Development dependencies." +msgstr "" + +#: ../../writing/structure.rst:153 +msgid "" +"A `pip requirements file `__ should be placed at the root of the repository. " +"It should specify the dependencies required to contribute to the project:" +" testing, building, and generating documentation." +msgstr "" + +#: ../../writing/structure.rst:159 +msgid "" +"If your project has no development dependencies, or if you prefer setting" +" up a development environment via ``setup.py``, this file may be " +"unnecessary." +msgstr "" + +#: ../../writing/structure.rst:164 +msgid "Documentation" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "``./docs/``" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "Package reference documentation." +msgstr "" + +#: ../../writing/structure.rst:173 +msgid "There is little reason for this to exist elsewhere." +msgstr "" + +#: ../../writing/structure.rst:176 +msgid "Test Suite" +msgstr "" + +#: ../../writing/structure.rst:179 +msgid "*For advice on writing your tests, see* :doc:`/writing/tests`." +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "``./test_sample.py`` or ``./tests``" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "Package integration and unit tests." +msgstr "" + +#: ../../writing/structure.rst:187 +msgid "Starting out, a small test suite will often exist in a single file:" +msgstr "" + +#: ../../writing/structure.rst:193 +msgid "Once a test suite grows, you can move your tests to a directory, like so:" +msgstr "" + +#: ../../writing/structure.rst:201 +msgid "" +"Obviously, these test modules must import your packaged module to test " +"it. You can do this a few ways:" +msgstr "" + +#: ../../writing/structure.rst:204 +msgid "Expect the package to be installed in site-packages." +msgstr "" + +#: ../../writing/structure.rst:205 +msgid "" +"Use a simple (but *explicit*) path modification to resolve the package " +"properly." +msgstr "" + +#: ../../writing/structure.rst:208 +msgid "" +"I highly recommend the latter. Requiring a developer to run ``setup.py " +"develop`` to test an actively changing codebase also requires them to " +"have an isolated environment setup for each instance of the codebase." +msgstr "" + +#: ../../writing/structure.rst:213 +msgid "" +"To give the individual tests import context, create a " +"``tests/context.py`` file:" +msgstr "" + +#: ../../writing/structure.rst:224 +msgid "Then, within the individual test modules, import the module like so:" +msgstr "" + +#: ../../writing/structure.rst:230 +msgid "This will always work as expected, regardless of installation method." +msgstr "" + +#: ../../writing/structure.rst:232 +msgid "" +"Some people will assert that you should distribute your tests within your" +" module itself -- I disagree. It often increases complexity for your " +"users; many test suites often require additional dependencies and runtime" +" contexts." +msgstr "" + +#: ../../writing/structure.rst:238 +msgid "Makefile" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "``./Makefile``" +msgstr "" + +#: ../../writing/structure.rst:1 +msgid "Generic management tasks." +msgstr "" + +#: ../../writing/structure.rst:248 +msgid "" +"If you look at most of my projects or any Pocoo project, you'll notice a " +"Makefile lying around. Why? These projects aren't written in C... In " +"short, make is an incredibly useful tool for defining generic tasks for " +"your project." +msgstr "" + +#: ../../writing/structure.rst:253 +msgid "**Sample Makefile:**" +msgstr "" + +#: ../../writing/structure.rst:265 +msgid "" +"Other generic management scripts (e.g. ``manage.py`` or ``fabfile.py``) " +"belong at the root of the repository as well." +msgstr "" + +#: ../../writing/structure.rst:269 +msgid "Regarding Django Applications" +msgstr "" + +#: ../../writing/structure.rst:271 +msgid "" +"I've noticed a new trend in Django applications since the release of " +"Django 1.4. Many developers are structuring their repositories poorly due" +" to the new bundled application templates." +msgstr "" + +#: ../../writing/structure.rst:275 +msgid "" +"How? Well, they go to their bare and fresh repository and run the " +"following, as they always have:" +msgstr "" + +#: ../../writing/structure.rst:282 +msgid "The resulting repository structure looks like this:" +msgstr "" + +#: ../../writing/structure.rst:292 +msgid "Don't do this." +msgstr "" + +#: ../../writing/structure.rst:294 +msgid "" +"Repetitive paths are confusing for both your tools and your developers. " +"Unnecessary nesting doesn't help anybody (unless they're nostalgic for " +"monolithic SVN repos)." +msgstr "" + +#: ../../writing/structure.rst:298 +msgid "Let's do it properly:" +msgstr "" + +#: ../../writing/structure.rst:304 +msgid "Note the \"``.``\"." +msgstr "" + +#: ../../writing/structure.rst:306 +msgid "The resulting structure:" +msgstr "" + +#: ../../writing/structure.rst:320 +msgid "Structure of Code is Key" +msgstr "" + +#: ../../writing/structure.rst:322 +msgid "" +"Thanks to the way imports and modules are handled in Python, it is " +"relatively easy to structure a Python project. Easy, here, means that you" +" do not have many constraints and that the module importing model is easy" +" to grasp. Therefore, you are left with the pure architectural task of " +"crafting the different parts of your project and their interactions." +msgstr "" + +#: ../../writing/structure.rst:329 +msgid "" +"Easy structuring of a project means it is also easy to do it poorly. Some" +" signs of a poorly structured project include:" +msgstr "" + +#: ../../writing/structure.rst:333 +msgid "" +"Multiple and messy circular dependencies: If the classes Table and Chair " +"in :file:`furn.py` need to import Carpenter from :file:`workers.py` to " +"answer a question such as ``table.isdoneby()``, and if conversely the " +"class Carpenter needs to import Table and Chair to answer the question " +"``carpenter.whatdo()``, then you have a circular dependency. In this case" +" you will have to resort to fragile hacks such as using import statements" +" inside your methods or functions." +msgstr "" + +#: ../../writing/structure.rst:342 +msgid "" +"Hidden coupling: Each and every change in Table's implementation breaks " +"20 tests in unrelated test cases because it breaks Carpenter's code, " +"which requires very careful surgery to adapt to the change. This means " +"you have too many assumptions about Table in Carpenter's code or the " +"reverse." +msgstr "" + +#: ../../writing/structure.rst:348 +msgid "" +"Heavy usage of global state or context: Instead of explicitly passing " +"``(height, width, type, wood)`` to each other, Table and Carpenter rely " +"on global variables that can be modified and are modified on the fly by " +"different agents. You need to scrutinize all access to these global " +"variables in order to understand why a rectangular table became a square," +" and discover that remote template code is also modifying this context, " +"messing with the table dimensions." +msgstr "" + +#: ../../writing/structure.rst:357 +msgid "" +"Spaghetti code: multiple pages of nested if clauses and for loops with a " +"lot of copy-pasted procedural code and no proper segmentation are known " +"as spaghetti code. Python's meaningful indentation (one of its most " +"controversial features) makes it very hard to maintain this kind of code." +" The good news is that you might not see too much of it." +msgstr "" + +#: ../../writing/structure.rst:364 +msgid "" +"Ravioli code is more likely in Python: it consists of hundreds of similar" +" little pieces of logic, often classes or objects, without proper " +"structure. If you never can remember, if you have to use FurnitureTable, " +"AssetTable or Table, or even TableNew for your task at hand, then you " +"might be swimming in ravioli code." +msgstr "" + +#: ../../writing/structure.rst:373 +msgid "Modules" +msgstr "" + +#: ../../writing/structure.rst:375 +msgid "" +"Python modules are one of the main abstraction layers available and " +"probably the most natural one. Abstraction layers allow separating code " +"into parts holding related data and functionality." +msgstr "" + +#: ../../writing/structure.rst:379 +msgid "" +"For example, a layer of a project can handle interfacing with user " +"actions, while another would handle low-level manipulation of data. The " +"most natural way to separate these two layers is to regroup all " +"interfacing functionality in one file, and all low-level operations in " +"another file. In this case, the interface file needs to import the low-" +"level file. This is done with the ``import`` and ``from ... import`` " +"statements." +msgstr "" + +#: ../../writing/structure.rst:386 +msgid "" +"As soon as you use `import` statements, you use modules. These can be " +"either built-in modules such as `os` and `sys`, third-party modules you " +"have installed in your environment, or your project's internal modules." +msgstr "" + +#: ../../writing/structure.rst:390 +msgid "" +"To keep in line with the style guide, keep module names short, lowercase," +" and be sure to avoid using special symbols like the dot (.) or question " +"mark (?). A file name like :file:`my.spam.py` is the one you should " +"avoid! Naming this way will interfere with the way Python looks for " +"modules." +msgstr "" + +#: ../../writing/structure.rst:395 +msgid "" +"In the case of `my.spam.py` Python expects to find a :file:`spam.py` file" +" in a folder named :file:`my` which is not the case. There is an `example" +" `_ of how the dot" +" notation should be used in the Python docs." +msgstr "" + +#: ../../writing/structure.rst:400 +msgid "" +"If you like, you could name your module :file:`my_spam.py`, but even our " +"trusty friend the underscore, should not be seen that often in module " +"names. However, using other characters (spaces or hyphens) in module " +"names will prevent importing (- is the subtract operator). Try to keep " +"module names short so there is no need to separate words. And, most of " +"all, don't namespace with underscores; use submodules instead." +msgstr "" + +#: ../../writing/structure.rst:413 +msgid "" +"Aside from some naming restrictions, nothing special is required for a " +"Python file to be a module. But you need to understand the import " +"mechanism in order to use this concept properly and avoid some issues." +msgstr "" + +#: ../../writing/structure.rst:417 +msgid "" +"Concretely, the ``import modu`` statement will look for the proper file, " +"which is :file:`modu.py` in the same directory as the caller, if it " +"exists. If it is not found, the Python interpreter will search for " +":file:`modu.py` in the \"path\" recursively and raise an ImportError " +"exception when it is not found." +msgstr "" + +#: ../../writing/structure.rst:422 +msgid "" +"When :file:`modu.py` is found, the Python interpreter will execute the " +"module in an isolated scope. Any top-level statement in :file:`modu.py` " +"will be executed, including other imports if any. Function and class " +"definitions are stored in the module's dictionary." +msgstr "" + +#: ../../writing/structure.rst:427 +msgid "" +"Then, the module's variables, functions, and classes will be available to" +" the caller through the module's namespace, a central concept in " +"programming that is particularly helpful and powerful in Python." +msgstr "" + +#: ../../writing/structure.rst:431 +msgid "" +"In many languages, an ``include file`` directive is used by the " +"preprocessor to take all code found in the file and 'copy' it into the " +"caller's code. It is different in Python: the included code is isolated " +"in a module namespace, which means that you generally don't have to worry" +" that the included code could have unwanted effects, e.g. override an " +"existing function with the same name." +msgstr "" + +#: ../../writing/structure.rst:437 +msgid "" +"It is possible to simulate the more standard behavior by using a special " +"syntax of the import statement: ``from modu import *``. This is generally" +" considered bad practice. **Using** ``import *`` **makes the code harder " +"to read and makes dependencies less compartmentalized**." +msgstr "" + +#: ../../writing/structure.rst:442 +msgid "" +"Using ``from modu import func`` is a way to pinpoint the function you " +"want to import and put it in the local namespace. While much less harmful" +" than ``import *`` because it shows explicitly what is imported in the " +"local namespace, its only advantage over a simpler ``import modu`` is " +"that it will save a little typing." +msgstr "" + +#: ../../writing/structure.rst:448 +msgid "**Very bad**" +msgstr "" + +#: ../../writing/structure.rst:457 ../../writing/structure.rst:827 +msgid "**Better**" +msgstr "" + +#: ../../writing/structure.rst:465 ../../writing/structure.rst:837 +msgid "**Best**" +msgstr "" + +#: ../../writing/structure.rst:473 +msgid "" +"As mentioned in the :ref:`code_style` section, readability is one of the " +"main features of Python. Readability means to avoid useless boilerplate " +"text and clutter; therefore some efforts are spent trying to achieve a " +"certain level of brevity. But terseness and obscurity are the limits " +"where brevity should stop. Being able to tell immediately where a class " +"or function comes from, as in the ``modu.func`` idiom, greatly improves " +"code readability and understandability in all but the simplest single " +"file projects." +msgstr "" + +#: ../../writing/structure.rst:484 +msgid "Packages" +msgstr "" + +#: ../../writing/structure.rst:486 +msgid "" +"Python provides a very straightforward packaging system, which is simply " +"an extension of the module mechanism to a directory." +msgstr "" + +#: ../../writing/structure.rst:489 +msgid "" +"Any directory with an :file:`__init__.py` file is considered a Python " +"package. The different modules in the package are imported in a similar " +"manner as plain modules, but with a special behavior for the " +":file:`__init__.py` file, which is used to gather all package-wide " +"definitions." +msgstr "" + +#: ../../writing/structure.rst:494 +msgid "" +"A file :file:`modu.py` in the directory :file:`pack/` is imported with " +"the statement ``import pack.modu``. This statement will look for " +":file:`__init__.py` file in :file:`pack` and execute all of its top-level" +" statements. Then it will look for a file named :file:`pack/modu.py` and " +"execute all of its top-level statements. After these operations, any " +"variable, function, or class defined in :file:`modu.py` is available in " +"the pack.modu namespace." +msgstr "" + +#: ../../writing/structure.rst:502 +msgid "" +"A commonly seen issue is adding too much code to :file:`__init__.py` " +"files. When the project complexity grows, there may be sub-packages and " +"sub-sub-packages in a deep directory structure. In this case, importing a" +" single item from a sub-sub-package will require executing all " +":file:`__init__.py` files met while traversing the tree." +msgstr "" + +#: ../../writing/structure.rst:508 +msgid "" +"Leaving an :file:`__init__.py` file empty is considered normal and even " +"good practice, if the package's modules and sub-packages do not need to " +"share any code." +msgstr "" + +#: ../../writing/structure.rst:512 +msgid "" +"Lastly, a convenient syntax is available for importing deeply nested " +"packages: ``import very.deep.module as mod``. This allows you to use " +"`mod` in place of the verbose repetition of ``very.deep.module``." +msgstr "" + +#: ../../writing/structure.rst:519 +msgid "Object-oriented programming" +msgstr "" + +#: ../../writing/structure.rst:521 +msgid "" +"Python is sometimes described as an object-oriented programming language." +" This can be somewhat misleading and requires further clarifications." +msgstr "" + +#: ../../writing/structure.rst:524 +msgid "" +"In Python, everything is an object, and can be handled as such. This is " +"what is meant when we say, for example, that functions are first-class " +"objects. Functions, classes, strings, and even types are objects in " +"Python: like any object, they have a type, they can be passed as function" +" arguments, and they may have methods and properties. In this " +"understanding, Python can be considered as an object-oriented language." +msgstr "" + +#: ../../writing/structure.rst:531 +msgid "" +"However, unlike Java, Python does not impose object-oriented programming " +"as the main programming paradigm. It is perfectly viable for a Python " +"project to not be object-oriented, i.e. to use no or very few class " +"definitions, class inheritance, or any other mechanisms that are specific" +" to object-oriented programming languages." +msgstr "" + +#: ../../writing/structure.rst:537 +msgid "" +"Moreover, as seen in the modules_ section, the way Python handles modules" +" and namespaces gives the developer a natural way to ensure the " +"encapsulation and separation of abstraction layers, both being the most " +"common reasons to use object-orientation. Therefore, Python programmers " +"have more latitude as to not use object-orientation, when it is not " +"required by the business model." +msgstr "" + +#: ../../writing/structure.rst:544 +msgid "" +"There are some reasons to avoid unnecessary object-orientation. Defining " +"custom classes is useful when we want to glue some state and some " +"functionality together. The problem, as pointed out by the discussions " +"about functional programming, comes from the \"state\" part of the " +"equation." +msgstr "" + +#: ../../writing/structure.rst:549 +msgid "" +"In some architectures, typically web applications, multiple instances of " +"Python processes are spawned as a response to external requests that " +"happen simultaneously. In this case, holding some state in instantiated " +"objects, which means keeping some static information about the world, is " +"prone to concurrency problems or race conditions. Sometimes, between the " +"initialization of the state of an object (usually done with the " +"``__init__()`` method) and the actual use of the object state through one" +" of its methods, the world may have changed, and the retained state may " +"be outdated. For example, a request may load an item in memory and mark " +"it as read by a user. If another request requires the deletion of this " +"item at the same time, the deletion may actually occur after the first " +"process loaded the item, and then we have to mark a deleted object as " +"read." +msgstr "" + +#: ../../writing/structure.rst:561 +msgid "" +"This and other issues led to the idea that using stateless functions is a" +" better programming paradigm." +msgstr "" + +#: ../../writing/structure.rst:564 +msgid "" +"Another way to say the same thing is to suggest using functions and " +"procedures with as few implicit contexts and side-effects as possible. A " +"function's implicit context is made up of any of the global variables or " +"items in the persistence layer that are accessed from within the " +"function. Side-effects are the changes that a function makes to its " +"implicit context. If a function saves or deletes data in a global " +"variable or in the persistence layer, it is said to have a side-effect." +msgstr "" + +#: ../../writing/structure.rst:572 +msgid "" +"Carefully isolating functions with context and side-effects from " +"functions with logic (called pure functions) allows the following " +"benefits:" +msgstr "" + +#: ../../writing/structure.rst:575 +msgid "" +"Pure functions are deterministic: given a fixed input, the output will " +"always be the same." +msgstr "" + +#: ../../writing/structure.rst:578 +msgid "" +"Pure functions are much easier to change or replace if they need to be " +"refactored or optimized." +msgstr "" + +#: ../../writing/structure.rst:581 +msgid "" +"Pure functions are easier to test with unit tests: There is less need for" +" complex context setup and data cleaning afterwards." +msgstr "" + +#: ../../writing/structure.rst:584 +msgid "Pure functions are easier to manipulate, decorate, and pass around." +msgstr "" + +#: ../../writing/structure.rst:586 +msgid "" +"In summary, pure functions are more efficient building blocks than " +"classes and objects for some architectures because they have no context " +"or side-effects." +msgstr "" + +#: ../../writing/structure.rst:589 +msgid "" +"Obviously, object-orientation is useful and even necessary in many cases," +" for example when developing graphical desktop applications or games, " +"where the things that are manipulated (windows, buttons, avatars, " +"vehicles) have a relatively long life of their own in the computer's " +"memory." +msgstr "" + +#: ../../writing/structure.rst:597 +msgid "Decorators" +msgstr "" + +#: ../../writing/structure.rst:599 +msgid "" +"The Python language provides a simple yet powerful syntax called " +"'decorators'. A decorator is a function or a class that wraps (or " +"decorates) a function or a method. The 'decorated' function or method " +"will replace the original 'undecorated' function or method. Because " +"functions are first-class objects in Python, this can be done 'manually'," +" but using the @decorator syntax is clearer and thus preferred." +msgstr "" + +#: ../../writing/structure.rst:622 +msgid "" +"This mechanism is useful for separating concerns and avoiding external " +"unrelated logic 'polluting' the core logic of the function or method. A " +"good example of a piece of functionality that is better handled with " +"decoration is `memoization " +"`__ or caching: you " +"want to store the results of an expensive function in a table and use " +"them directly instead of recomputing them when they have already been " +"computed. This is clearly not part of the function logic." +msgstr "" + +#: ../../writing/structure.rst:633 +msgid "Context Managers" +msgstr "" + +#: ../../writing/structure.rst:635 +msgid "" +"A context manager is a Python object that provides extra contextual " +"information to an action. This extra information takes the form of " +"running a callable upon initiating the context using the ``with`` " +"statement, as well as running a callable upon completing all the code " +"inside the ``with`` block. The most well known example of using a context" +" manager is shown here, opening on a file:" +msgstr "" + +#: ../../writing/structure.rst:646 +msgid "" +"Anyone familiar with this pattern knows that invoking ``open`` in this " +"fashion ensures that ``f``'s ``close`` method will be called at some " +"point. This reduces a developer's cognitive load and makes the code " +"easier to read." +msgstr "" + +#: ../../writing/structure.rst:650 +msgid "" +"There are two easy ways to implement this functionality yourself: using a" +" class or using a generator. Let's implement the above functionality " +"ourselves, starting with the class approach:" +msgstr "" + +#: ../../writing/structure.rst:669 +msgid "" +"This is just a regular Python object with two extra methods that are used" +" by the ``with`` statement. CustomOpen is first instantiated and then its" +" ``__enter__`` method is called and whatever ``__enter__`` returns is " +"assigned to ``f`` in the ``as f`` part of the statement. When the " +"contents of the ``with`` block is finished executing, the ``__exit__`` " +"method is then called." +msgstr "" + +#: ../../writing/structure.rst:675 +msgid "" +"And now the generator approach using Python's own `contextlib " +"`_:" +msgstr "" + +#: ../../writing/structure.rst:693 +msgid "" +"This works in exactly the same way as the class example above, albeit " +"it's more terse. The ``custom_open`` function executes until it reaches " +"the ``yield`` statement. It then gives control back to the ``with`` " +"statement, which assigns whatever was ``yield``'ed to `f` in the ``as f``" +" portion. The ``finally`` clause ensures that ``close()`` is called " +"whether or not there was an exception inside the ``with``." +msgstr "" + +#: ../../writing/structure.rst:700 +msgid "" +"Since the two approaches appear the same, we should follow the Zen of " +"Python to decide when to use which. The class approach might be better if" +" there's a considerable amount of logic to encapsulate. The function " +"approach might be better for situations where we're dealing with a simple" +" action." +msgstr "" + +#: ../../writing/structure.rst:708 +msgid "Dynamic typing" +msgstr "" + +#: ../../writing/structure.rst:710 +msgid "" +"Python is dynamically typed, which means that variables do not have a " +"fixed type. In fact, in Python, variables are very different from what " +"they are in many other languages, specifically statically-typed " +"languages. Variables are not a segment of the computer's memory where " +"some value is written, they are 'tags' or 'names' pointing to objects. It" +" is therefore possible for the variable 'a' to be set to the value 1, " +"then the value 'a string', to a function." +msgstr "" + +#: ../../writing/structure.rst:717 +msgid "" +"The dynamic typing of Python is often considered to be a weakness, and " +"indeed it can lead to complexities and hard-to-debug code. Something " +"named 'a' can be set to many different things, and the developer or the " +"maintainer needs to track this name in the code to make sure it has not " +"been set to a completely unrelated object." +msgstr "" + +#: ../../writing/structure.rst:723 +msgid "Some guidelines help to avoid this issue:" +msgstr "" + +#: ../../writing/structure.rst:725 +msgid "Avoid using the same variable name for different things." +msgstr "" + +#: ../../writing/structure.rst:727 ../../writing/structure.rst:751 +#: ../../writing/structure.rst:817 +msgid "**Bad**" +msgstr "" + +#: ../../writing/structure.rst:736 +msgid "**Good**" +msgstr "" + +#: ../../writing/structure.rst:745 +msgid "" +"Using short functions or methods helps to reduce the risk of using the " +"same name for two unrelated things." +msgstr "" + +#: ../../writing/structure.rst:748 +msgid "" +"It is better to use different names even for things that are related, " +"when they have a different type:" +msgstr "" + +#: ../../writing/structure.rst:759 +msgid "" +"There is no efficiency gain when reusing names: the assignments will have" +" to create new objects anyway. However, when the complexity grows and " +"each assignment is separated by other lines of code, including 'if' " +"branches and loops, it becomes harder to ascertain what a given " +"variable's type is." +msgstr "" + +#: ../../writing/structure.rst:765 +msgid "" +"Some coding practices, like functional programming, recommend never " +"reassigning a variable. In Java this is done with the `final` keyword. " +"Python does not have a `final` keyword and it would be against its " +"philosophy anyway. However, it may be a good discipline to avoid " +"assigning to a variable more than once, and it helps in grasping the " +"concept of mutable and immutable types." +msgstr "" + +#: ../../writing/structure.rst:774 +msgid "Mutable and immutable types" +msgstr "" + +#: ../../writing/structure.rst:776 +msgid "Python has two kinds of built-in or user-defined types." +msgstr "" + +#: ../../writing/structure.rst:778 +msgid "" +"Mutable types are those that allow in-place modification of the content. " +"Typical mutables are lists and dictionaries: All lists have mutating " +"methods, like :py:meth:`list.append` or :py:meth:`list.pop`, and can be " +"modified in place. The same goes for dictionaries." +msgstr "" + +#: ../../writing/structure.rst:783 +msgid "" +"Immutable types provide no method for changing their content. For " +"instance, the variable x set to the integer 6 has no \"increment\" " +"method. If you want to compute x + 1, you have to create another integer " +"and give it a name." +msgstr "" + +#: ../../writing/structure.rst:796 +msgid "" +"One consequence of this difference in behavior is that mutable types are " +"not \"stable\", and therefore cannot be used as dictionary keys." +msgstr "" + +#: ../../writing/structure.rst:800 +msgid "" +"Using properly mutable types for things that are mutable in nature and " +"immutable types for things that are fixed in nature helps to clarify the " +"intent of the code." +msgstr "" + +#: ../../writing/structure.rst:804 +msgid "" +"For example, the immutable equivalent of a list is the tuple, created " +"with ``(1, 2)``. This tuple is a pair that cannot be changed in-place, " +"and can be used as a key for a dictionary." +msgstr "" + +#: ../../writing/structure.rst:808 +msgid "" +"One peculiarity of Python that can surprise beginners is that strings are" +" immutable. This means that when constructing a string from its parts, " +"appending each part to the string is inefficient because the entirety of " +"the string is copied on each append. Instead, it is much more efficient " +"to accumulate the parts in a list, which is mutable, and then glue " +"(``join``) the parts together when the full string is needed. List " +"comprehensions are usually the fastest and most idiomatic way to do this." +msgstr "" + +#: ../../writing/structure.rst:845 +msgid "" +"One final thing to mention about strings is that using ``join()`` is not " +"always best. In the instances where you are creating a new string from a " +"pre-determined number of strings, using the addition operator is actually" +" faster. But in cases like above or in cases where you are adding to an " +"existing string, using ``join()`` should be your preferred method." +msgstr "" + +#: ../../writing/structure.rst:861 +msgid "" +"You can also use the :ref:`% ` formatting " +"operator to concatenate a pre-determined number of strings besides " +":py:meth:`str.join` and ``+``. However, :pep:`3101` discourages the usage" +" of the ``%`` operator in favor of the :py:meth:`str.format` method." +msgstr "" + +#: ../../writing/structure.rst:878 +msgid "Vendorizing Dependencies" +msgstr "" + +#: ../../writing/structure.rst:884 +msgid "Runners" +msgstr "" + +#: ../../writing/structure.rst:889 +msgid "Further Reading" +msgstr "" + +#: ../../writing/structure.rst:891 +msgid "http://docs.python.org/3/library/" +msgstr "" + +#: ../../writing/structure.rst:892 +msgid "https://diveintopython3.net/" +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/writing/style.po b/locales/zh_CN/LC_MESSAGES/writing/style.po new file mode 100644 index 000000000..aeed4a781 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/writing/style.po @@ -0,0 +1,838 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../writing/style.rst:6 +msgid "Code Style" +msgstr "" + +#: ../../writing/style.rst:10 +msgid "" +"If you ask Python programmers what they like most about Python, they will" +" often cite its high readability. Indeed, a high level of readability is " +"at the heart of the design of the Python language, following the " +"recognized fact that code is read much more often than it is written." +msgstr "" + +#: ../../writing/style.rst:15 +msgid "" +"One reason for the high readability of Python code is its relatively " +"complete set of Code Style guidelines and \"Pythonic\" idioms." +msgstr "" + +#: ../../writing/style.rst:18 +msgid "" +"When a veteran Python developer (a Pythonista) calls portions of code not" +" \"Pythonic\", they usually mean that these lines of code do not follow " +"the common guidelines and fail to express its intent in what is " +"considered the best (hear: most readable) way." +msgstr "" + +#: ../../writing/style.rst:23 +msgid "" +"On some border cases, no best way has been agreed upon on how to express " +"an intent in Python code, but these cases are rare." +msgstr "" + +#: ../../writing/style.rst:29 +msgid "General concepts" +msgstr "" + +#: ../../writing/style.rst:32 +msgid "Explicit code" +msgstr "" + +#: ../../writing/style.rst:34 +msgid "" +"While any kind of black magic is possible with Python, the most explicit " +"and straightforward manner is preferred." +msgstr "" + +#: ../../writing/style.rst:37 ../../writing/style.rst:64 +msgid "**Bad**" +msgstr "" + +#: ../../writing/style.rst:45 ../../writing/style.rst:75 +msgid "**Good**" +msgstr "" + +#: ../../writing/style.rst:52 +msgid "" +"In the good code above, x and y are explicitly received from the caller, " +"and an explicit dictionary is returned. The developer using this function" +" knows exactly what to do by reading the first and last lines, which is " +"not the case with the bad example." +msgstr "" + +#: ../../writing/style.rst:58 +msgid "One statement per line" +msgstr "" + +#: ../../writing/style.rst:60 +msgid "" +"While some compound statements such as list comprehensions are allowed " +"and appreciated for their brevity and their expressiveness, it is bad " +"practice to have two disjointed statements on the same line of code." +msgstr "" + +#: ../../writing/style.rst:91 +msgid "Function arguments" +msgstr "" + +#: ../../writing/style.rst:93 +msgid "Arguments can be passed to functions in four different ways." +msgstr "" + +#: ../../writing/style.rst:95 +msgid "" +"**Positional arguments** are mandatory and have no default values. They " +"are the simplest form of arguments and they can be used for the few " +"function arguments that are fully part of the function's meaning and " +"their order is natural. For instance, in ``send(message, recipient)`` or " +"``point(x, y)`` the user of the function has no difficulty remembering " +"that those two functions require two arguments, and in which order." +msgstr "" + +#: ../../writing/style.rst:102 +msgid "" +"In those two cases, it is possible to use argument names when calling the" +" functions and, doing so, it is possible to switch the order of " +"arguments, calling for instance ``send(recipient='World', " +"message='Hello')`` and ``point(y=2, x=1)`` but this reduces readability " +"and is unnecessarily verbose, compared to the more straightforward calls " +"to ``send('Hello', 'World')`` and ``point(1, 2)``." +msgstr "" + +#: ../../writing/style.rst:109 +msgid "" +"**Keyword arguments** are not mandatory and have default values. They are" +" often used for optional parameters sent to the function. When a function" +" has more than two or three positional parameters, its signature is more " +"difficult to remember and using keyword arguments with default values is " +"helpful. For instance, a more complete ``send`` function could be defined" +" as ``send(message, to, cc=None, bcc=None)``. Here ``cc`` and ``bcc`` are" +" optional, and evaluate to ``None`` when they are not passed another " +"value." +msgstr "" + +#: ../../writing/style.rst:117 +msgid "" +"Calling a function with keyword arguments can be done in multiple ways in" +" Python; for example, it is possible to follow the order of arguments in " +"the definition without explicitly naming the arguments, like in " +"``send('Hello', 'World', 'Cthulhu', 'God')``, sending a blind carbon copy" +" to God. It would also be possible to name arguments in another order, " +"like in ``send('Hello again', 'World', bcc='God', cc='Cthulhu')``. Those " +"two possibilities are better avoided without any strong reason to not " +"follow the syntax that is the closest to the function definition: " +"``send('Hello', 'World', cc='Cthulhu', bcc='God')``." +msgstr "" + +#: ../../writing/style.rst:127 +msgid "" +"As a side note, following the `YAGNI " +"`_ principle, it is" +" often harder to remove an optional argument (and its logic inside the " +"function) that was added \"just in case\" and is seemingly never used, " +"than to add a new optional argument and its logic when needed." +msgstr "" + +#: ../../writing/style.rst:132 +msgid "" +"The **arbitrary argument list** is the third way to pass arguments to a " +"function. If the function intention is better expressed by a signature " +"with an extensible number of positional arguments, it can be defined with" +" the ``*args`` constructs. In the function body, ``args`` will be a tuple" +" of all the remaining positional arguments. For example, ``send(message, " +"*args)`` can be called with each recipient as an argument: " +"``send('Hello', 'God', 'Mom', 'Cthulhu')``, and in the function body " +"``args`` will be equal to ``('God', 'Mom', 'Cthulhu')``." +msgstr "" + +#: ../../writing/style.rst:141 +msgid "" +"However, this construct has some drawbacks and should be used with " +"caution. If a function receives a list of arguments of the same nature, " +"it is often more clear to define it as a function of one argument, that " +"argument being a list or any sequence. Here, if ``send`` has multiple " +"recipients, it is better to define it explicitly: ``send(message, " +"recipients)`` and call it with ``send('Hello', ['God', 'Mom', " +"'Cthulhu'])``. This way, the user of the function can manipulate the " +"recipient list as a list beforehand, and it opens the possibility to pass" +" any sequence, including iterators, that cannot be unpacked as other " +"sequences." +msgstr "" + +#: ../../writing/style.rst:150 +msgid "" +"The **arbitrary keyword argument dictionary** is the last way to pass " +"arguments to functions. If the function requires an undetermined series " +"of named arguments, it is possible to use the ``**kwargs`` construct. In " +"the function body, ``kwargs`` will be a dictionary of all the passed " +"named arguments that have not been caught by other keyword arguments in " +"the function signature." +msgstr "" + +#: ../../writing/style.rst:157 +msgid "" +"The same caution as in the case of *arbitrary argument list* is " +"necessary, for similar reasons: these powerful techniques are to be used " +"when there is a proven necessity to use them, and they should not be used" +" if the simpler and clearer construct is sufficient to express the " +"function's intention." +msgstr "" + +#: ../../writing/style.rst:162 +msgid "" +"It is up to the programmer writing the function to determine which " +"arguments are positional arguments and which are optional keyword " +"arguments, and to decide whether to use the advanced techniques of " +"arbitrary argument passing. If the advice above is followed wisely, it is" +" possible and enjoyable to write Python functions that are:" +msgstr "" + +#: ../../writing/style.rst:168 +msgid "easy to read (the name and arguments need no explanations)" +msgstr "" + +#: ../../writing/style.rst:170 +msgid "" +"easy to change (adding a new keyword argument does not break other parts " +"of the code)" +msgstr "" + +#: ../../writing/style.rst:174 +msgid "Avoid the magical wand" +msgstr "" + +#: ../../writing/style.rst:176 +msgid "" +"A powerful tool for hackers, Python comes with a very rich set of hooks " +"and tools allowing you to do almost any kind of tricky tricks. For " +"instance, it is possible to do each of the following:" +msgstr "" + +#: ../../writing/style.rst:180 +msgid "change how objects are created and instantiated" +msgstr "" + +#: ../../writing/style.rst:182 +msgid "change how the Python interpreter imports modules" +msgstr "" + +#: ../../writing/style.rst:184 +msgid "" +"It is even possible (and recommended if needed) to embed C routines in " +"Python." +msgstr "" + +#: ../../writing/style.rst:186 +msgid "" +"However, all these options have many drawbacks and it is always better to" +" use the most straightforward way to achieve your goal. The main drawback" +" is that readability suffers greatly when using these constructs. Many " +"code analysis tools, such as pylint or pyflakes, will be unable to parse " +"this \"magic\" code." +msgstr "" + +#: ../../writing/style.rst:191 +msgid "" +"We consider that a Python developer should know about these nearly " +"infinite possibilities, because it instills confidence that no impassable" +" problem will be on the way. However, knowing how and particularly when " +"**not** to use them is very important." +msgstr "" + +#: ../../writing/style.rst:196 +msgid "" +"Like a kung fu master, a Pythonista knows how to kill with a single " +"finger, and never to actually do it." +msgstr "" + +#: ../../writing/style.rst:200 +msgid "We are all responsible users" +msgstr "" + +#: ../../writing/style.rst:202 +msgid "" +"As seen above, Python allows many tricks, and some of them are " +"potentially dangerous. A good example is that any client code can " +"override an object's properties and methods: there is no \"private\" " +"keyword in Python. This philosophy, very different from highly defensive " +"languages like Java, which give a lot of mechanisms to prevent any " +"misuse, is expressed by the saying: \"We are all responsible users\"." +msgstr "" + +#: ../../writing/style.rst:209 +msgid "" +"This doesn't mean that, for example, no properties are considered " +"private, and that no proper encapsulation is possible in Python. Rather, " +"instead of relying on concrete walls erected by the developers between " +"their code and others', the Python community prefers to rely on a set of " +"conventions indicating that these elements should not be accessed " +"directly." +msgstr "" + +#: ../../writing/style.rst:215 +msgid "" +"The main convention for private properties and implementation details is " +"to prefix all \"internals\" with an underscore. If the client code breaks" +" this rule and accesses these marked elements, any misbehavior or " +"problems encountered if the code is modified is the responsibility of the" +" client code." +msgstr "" + +#: ../../writing/style.rst:220 +msgid "" +"Using this convention generously is encouraged: any method or property " +"that is not intended to be used by client code should be prefixed with an" +" underscore. This will guarantee a better separation of duties and easier" +" modification of existing code; it will always be possible to publicize a" +" private property, but making a public property private might be a much " +"harder operation." +msgstr "" + +#: ../../writing/style.rst:227 +msgid "Returning values" +msgstr "" + +#: ../../writing/style.rst:229 +msgid "" +"When a function grows in complexity, it is not uncommon to use multiple " +"return statements inside the function's body. However, in order to keep a" +" clear intent and a sustainable readability level, it is preferable to " +"avoid returning meaningful values from many output points in the body." +msgstr "" + +#: ../../writing/style.rst:234 +msgid "" +"There are two main cases for returning values in a function: the result " +"of the function return when it has been processed normally, and the error" +" cases that indicate a wrong input parameter or any other reason for the " +"function to not be able to complete its computation or task." +msgstr "" + +#: ../../writing/style.rst:239 +msgid "" +"If you do not wish to raise exceptions for the second case, then " +"returning a value, such as None or False, indicating that the function " +"could not perform correctly might be needed. In this case, it is better " +"to return as early as the incorrect context has been detected. It will " +"help to flatten the structure of the function: all the code after the " +"return-because-of-error statement can assume the condition is met to " +"further compute the function's main result. Having multiple such return " +"statements is often necessary." +msgstr "" + +#: ../../writing/style.rst:247 +msgid "" +"However, when a function has multiple main exit points for its normal " +"course, it becomes difficult to debug the returned result, so it may be " +"preferable to keep a single exit point. This will also help factoring out" +" some code paths, and the multiple exit points are a probable indication " +"that such a refactoring is needed." +msgstr "" + +#: ../../writing/style.rst:270 +msgid "Idioms" +msgstr "" + +#: ../../writing/style.rst:272 +msgid "" +"A programming idiom, put simply, is a *way* to write code. The notion of " +"programming idioms is discussed amply at `c2 " +"`_ and at `Stack Overflow " +"`_." +msgstr "" + +#: ../../writing/style.rst:276 +msgid "Idiomatic Python code is often referred to as being *Pythonic*." +msgstr "" + +#: ../../writing/style.rst:278 +msgid "" +"Although there usually is one --- and preferably only one --- obvious way" +" to do it; *the* way to write idiomatic Python code can be non-obvious to" +" Python beginners. So, good idioms must be consciously acquired." +msgstr "" + +#: ../../writing/style.rst:282 +msgid "Some common Python idioms follow:" +msgstr "" + +#: ../../writing/style.rst:287 +msgid "Unpacking" +msgstr "" + +#: ../../writing/style.rst:289 +msgid "" +"If you know the length of a list or tuple, you can assign names to its " +"elements with unpacking. For example, since ``enumerate()`` will provide " +"a tuple of two elements for each item in list:" +msgstr "" + +#: ../../writing/style.rst:298 +msgid "You can use this to swap variables as well:" +msgstr "" + +#: ../../writing/style.rst:304 +msgid "Nested unpacking works too:" +msgstr "" + +#: ../../writing/style.rst:310 +msgid "" +"In Python 3, a new method of extended unpacking was introduced by " +":pep:`3132`:" +msgstr "" + +#: ../../writing/style.rst:321 +msgid "Create an ignored variable" +msgstr "" + +#: ../../writing/style.rst:323 +msgid "" +"If you need to assign something (for instance, in :ref:`unpacking-ref`) " +"but will not need that variable, use ``__``:" +msgstr "" + +#: ../../writing/style.rst:333 +msgid "" +"Many Python style guides recommend the use of a single underscore " +"\"``_``\" for throwaway variables rather than the double underscore " +"\"``__``\" recommended here. The issue is that \"``_``\" is commonly used" +" as an alias for the :func:`~gettext.gettext` function, and is also used " +"at the interactive prompt to hold the value of the last operation. Using " +"a double underscore instead is just as clear and almost as convenient, " +"and eliminates the risk of accidentally interfering with either of these " +"other use cases." +msgstr "" + +#: ../../writing/style.rst:343 +msgid "Create a length-N list of the same thing" +msgstr "" + +#: ../../writing/style.rst:345 +msgid "Use the Python list ``*`` operator:" +msgstr "" + +#: ../../writing/style.rst:352 +msgid "Create a length-N list of lists" +msgstr "" + +#: ../../writing/style.rst:354 +msgid "" +"Because lists are mutable, the ``*`` operator (as above) will create a " +"list of N references to the `same` list, which is not likely what you " +"want. Instead, use a list comprehension:" +msgstr "" + +#: ../../writing/style.rst:363 +msgid "Create a string from a list" +msgstr "" + +#: ../../writing/style.rst:365 +msgid "" +"A common idiom for creating strings is to use :py:meth:`str.join` on an " +"empty string." +msgstr "" + +#: ../../writing/style.rst:373 +msgid "" +"This will set the value of the variable *word* to 'spam'. This idiom can " +"be applied to lists and tuples." +msgstr "" + +#: ../../writing/style.rst:377 +msgid "Searching for an item in a collection" +msgstr "" + +#: ../../writing/style.rst:379 +msgid "" +"Sometimes we need to search through a collection of things. Let's look at" +" two options: lists and sets." +msgstr "" + +#: ../../writing/style.rst:382 +msgid "Take the following code for example:" +msgstr "" + +#: ../../writing/style.rst:395 +msgid "" +"Even though both functions look identical, because *lookup_set* is " +"utilizing the fact that sets in Python are hashtables, the lookup " +"performance between the two is very different. To determine whether an " +"item is in a list, Python will have to go through each item until it " +"finds a matching item. This is time consuming, especially for long lists." +" In a set, on the other hand, the hash of the item will tell Python where" +" in the set to look for a matching item. As a result, the search can be " +"done quickly, even if the set is large. Searching in dictionaries works " +"the same way. For more information see this `StackOverflow " +"`_ page. For detailed information on the amount of time various " +"common operations take on each of these data structures, see `this page " +"`_." +msgstr "" + +#: ../../writing/style.rst:409 +msgid "" +"Because of these differences in performance, it is often a good idea to " +"use sets or dictionaries instead of lists in cases where:" +msgstr "" + +#: ../../writing/style.rst:412 +msgid "The collection will contain a large number of items" +msgstr "" + +#: ../../writing/style.rst:414 +msgid "You will be repeatedly searching for items in the collection" +msgstr "" + +#: ../../writing/style.rst:416 +msgid "You do not have duplicate items." +msgstr "" + +#: ../../writing/style.rst:418 +msgid "" +"For small collections, or collections which you will not frequently be " +"searching through, the additional time and memory required to set up the " +"hashtable will often be greater than the time saved by the improved " +"search speed." +msgstr "" + +#: ../../writing/style.rst:426 +msgid "Zen of Python" +msgstr "" + +#: ../../writing/style.rst:428 +msgid "Also known as :pep:`20`, the guiding principles for Python's design." +msgstr "" + +#: ../../writing/style.rst:455 +msgid "" +"For some examples of good Python style, see `these slides from a Python " +"user group `_." +msgstr "" + +#: ../../writing/style.rst:461 +msgid "PEP 8" +msgstr "" + +#: ../../writing/style.rst:463 +msgid "" +":pep:`8` is the de facto code style guide for Python. A high quality, " +"easy-to-read version of PEP 8 is also available at `pep8.org " +"`_." +msgstr "" + +#: ../../writing/style.rst:466 +msgid "" +"This is highly recommended reading. The entire Python community does " +"their best to adhere to the guidelines laid out within this document. " +"Some project may sway from it from time to time, while others may `amend " +"its recommendations `_." +msgstr "" + +#: ../../writing/style.rst:471 +msgid "" +"That being said, conforming your Python code to PEP 8 is generally a good" +" idea and helps make code more consistent when working on projects with " +"other developers. There is a command-line program, `pycodestyle " +"`_ (previously known as ``pep8``), " +"that can check your code for conformance. Install it by running the " +"following command in your terminal:" +msgstr "" + +#: ../../writing/style.rst:483 +msgid "" +"Then run it on a file or series of files to get a report of any " +"violations." +msgstr "" + +#: ../../writing/style.rst:498 +msgid "Auto-Formatting" +msgstr "" + +#: ../../writing/style.rst:500 +msgid "" +"There are several auto-formatting tools that can reformat your code, in " +"order to comply with PEP 8." +msgstr "" + +#: ../../writing/style.rst:503 +msgid "**autopep8**" +msgstr "" + +#: ../../writing/style.rst:505 +msgid "" +"The program `autopep8 `_ can be used " +"to automatically reformat code in the PEP 8 style. Install the program " +"with:" +msgstr "" + +#: ../../writing/style.rst:512 +msgid "Use it to format a file in-place with:" +msgstr "" + +#: ../../writing/style.rst:518 +msgid "" +"Excluding the ``--in-place`` flag will cause the program to output the " +"modified code directly to the console for review. The ``--aggressive`` " +"flag will perform more substantial changes and can be applied multiple " +"times for greater effect." +msgstr "" + +#: ../../writing/style.rst:522 +msgid "**yapf**" +msgstr "" + +#: ../../writing/style.rst:524 +msgid "" +"While autopep8 focuses on solving the PEP 8 violations, `yapf " +"`_ tries to improve the format of your " +"code aside from complying with PEP 8. This formatter aims at providing as" +" good looking code as a programmer who writes PEP 8 compliant code. It " +"gets installed with:" +msgstr "" + +#: ../../writing/style.rst:534 +msgid "Run the auto-formatting of a file with:" +msgstr "" + +#: ../../writing/style.rst:540 +msgid "" +"Similar to autopep8, running the command without the ``--in-place`` flag " +"will output the diff for review before applying the changes." +msgstr "" + +#: ../../writing/style.rst:543 +msgid "**black**" +msgstr "" + +#: ../../writing/style.rst:545 +msgid "" +"The auto-formatter `black `_ offers an " +"opinionated and deterministic reformatting of your code base. Its main " +"focus lies in providing a uniform code style without the need of " +"configuration throughout its users. Hence, users of black are able to " +"forget about formatting altogether. Also, due to the deterministic " +"approach minimal git diffs with only the relevant changes are guaranteed." +" You can install the tool as follows:" +msgstr "" + +#: ../../writing/style.rst:557 +msgid "A python file can be formatted with:" +msgstr "" + +#: ../../writing/style.rst:563 +msgid "" +"Adding the ``--diff`` flag provides the code modification for review " +"without direct application." +msgstr "" + +#: ../../writing/style.rst:568 +msgid "Conventions" +msgstr "" + +#: ../../writing/style.rst:570 +msgid "" +"Here are some conventions you should follow to make your code easier to " +"read." +msgstr "" + +#: ../../writing/style.rst:573 +msgid "Check if a variable equals a constant" +msgstr "" + +#: ../../writing/style.rst:575 +msgid "" +"You don't need to explicitly compare a value to True, or None, or 0 -- " +"you can just add it to the if statement. See `Truth Value Testing " +"`_ for " +"a list of what is considered false." +msgstr "" + +#: ../../writing/style.rst:580 ../../writing/style.rst:612 +#: ../../writing/style.rst:650 ../../writing/style.rst:691 +#: ../../writing/style.rst:708 ../../writing/style.rst:753 +#: ../../writing/style.rst:799 ../../writing/style.rst:834 +msgid "**Bad**:" +msgstr "" + +#: ../../writing/style.rst:590 ../../writing/style.rst:622 +#: ../../writing/style.rst:657 ../../writing/style.rst:671 +#: ../../writing/style.rst:697 ../../writing/style.rst:727 +#: ../../writing/style.rst:766 ../../writing/style.rst:808 +#: ../../writing/style.rst:845 +msgid "**Good**:" +msgstr "" + +#: ../../writing/style.rst:607 +msgid "Access a Dictionary Element" +msgstr "" + +#: ../../writing/style.rst:609 +msgid "" +"Don't use the :py:meth:`dict.has_key` method. Instead, use ``x in d`` " +"syntax, or pass a default argument to :py:meth:`dict.get`." +msgstr "" + +#: ../../writing/style.rst:636 +msgid "Short Ways to Manipulate Lists" +msgstr "" + +#: ../../writing/style.rst:638 +msgid "" +"`List comprehensions `_ provides a powerful, concise way to work with " +"lists." +msgstr "" + +#: ../../writing/style.rst:642 +msgid "" +"`Generator expressions `_ follows almost the same syntax as list " +"comprehensions but return a generator instead of a list." +msgstr "" + +#: ../../writing/style.rst:647 +msgid "" +"Creating a new list requires more work and uses more memory. If you are " +"just going to loop through the new list, prefer using an iterator " +"instead." +msgstr "" + +#: ../../writing/style.rst:664 +msgid "" +"Use list comprehensions when you really need to create a second list, for" +" example if you need to use the result multiple times." +msgstr "" + +#: ../../writing/style.rst:668 +msgid "" +"If your logic is too complicated for a short list comprehension or " +"generator expression, consider using a generator function instead of " +"returning a list." +msgstr "" + +#: ../../writing/style.rst:689 +msgid "Never use a list comprehension just for its side effects." +msgstr "" + +#: ../../writing/style.rst:706 +msgid "Filtering a list" +msgstr "" + +#: ../../writing/style.rst:710 +msgid "Never remove items from a list while you are iterating through it." +msgstr "" + +#: ../../writing/style.rst:720 +msgid "Don't make multiple passes through the list." +msgstr "" + +#: ../../writing/style.rst:729 +msgid "Use a list comprehension or generator expression." +msgstr "" + +#: ../../writing/style.rst:741 +msgid "Possible side effects of modifying the original list" +msgstr "" + +#: ../../writing/style.rst:743 +msgid "" +"Modifying the original list can be risky if there are other variables " +"referencing it. But you can use *slice assignment* if you really want to " +"do that." +msgstr "" + +#: ../../writing/style.rst:752 +msgid "Modifying the values in a list" +msgstr "" + +#: ../../writing/style.rst:755 +msgid "" +"Remember that assignment never creates a new object. If two or more " +"variables refer to the same list, changing one of them changes them all." +msgstr "" + +#: ../../writing/style.rst:768 +msgid "It's safer to create a new list object and leave the original alone." +msgstr "" + +#: ../../writing/style.rst:778 +msgid "Use :py:func:`enumerate` keep a count of your place in the list." +msgstr "" + +#: ../../writing/style.rst:790 +msgid "" +"The :py:func:`enumerate` function has better readability than handling a " +"counter manually. Moreover, it is better optimized for iterators." +msgstr "" + +#: ../../writing/style.rst:794 +msgid "Read From a File" +msgstr "" + +#: ../../writing/style.rst:796 +msgid "" +"Use the ``with open`` syntax to read from files. This will automatically " +"close files for you." +msgstr "" + +#: ../../writing/style.rst:816 +msgid "" +"The ``with`` statement is better because it will ensure you always close " +"the file, even if an exception is raised inside the ``with`` block." +msgstr "" + +#: ../../writing/style.rst:820 +msgid "Line Continuations" +msgstr "" + +#: ../../writing/style.rst:822 +msgid "" +"When a logical line of code is longer than the accepted limit, you need " +"to split it over multiple physical lines. The Python interpreter will " +"join consecutive lines if the last character of the line is a backslash. " +"This is helpful in some cases, but should usually be avoided because of " +"its fragility: a white space added to the end of the line, after the " +"backslash, will break the code and may have unexpected results." +msgstr "" + +#: ../../writing/style.rst:829 +msgid "" +"A better solution is to use parentheses around your elements. Left with " +"an unclosed parenthesis on an end-of-line, the Python interpreter will " +"join the next line until the parentheses are closed. The same behavior " +"holds for curly and square braces." +msgstr "" + +#: ../../writing/style.rst:858 +msgid "" +"However, more often than not, having to split a long logical line is a " +"sign that you are trying to do too many things at the same time, which " +"may hinder readability." +msgstr "" + diff --git a/locales/zh_CN/LC_MESSAGES/writing/tests.po b/locales/zh_CN/LC_MESSAGES/writing/tests.po new file mode 100644 index 000000000..c80c7a540 --- /dev/null +++ b/locales/zh_CN/LC_MESSAGES/writing/tests.po @@ -0,0 +1,329 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) 2011-2021 Kenneth Reitz & Real Python. CC BY-NC-SA +# 3.0 +# This file is distributed under the same license as the pythonguide +# package. +# FIRST AUTHOR , 2021. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: pythonguide 0.0.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-04 19:30+0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 2.9.1\n" + +#: ../../writing/tests.rst:5 +msgid "Testing Your Code" +msgstr "" + +#: ../../writing/tests.rst:9 +msgid "Testing your code is very important." +msgstr "" + +#: ../../writing/tests.rst:11 +msgid "" +"Getting used to writing testing code and running this code in parallel is" +" now considered a good habit. Used wisely, this method helps to define " +"your code's intent more precisely and have a more decoupled architecture." +msgstr "" + +#: ../../writing/tests.rst:15 +msgid "Some general rules of testing:" +msgstr "" + +#: ../../writing/tests.rst:17 +msgid "" +"A testing unit should focus on one tiny bit of functionality and prove it" +" correct." +msgstr "" + +#: ../../writing/tests.rst:20 +msgid "" +"Each test unit must be fully independent. Each test must be able to run " +"alone, and also within the test suite, regardless of the order that they " +"are called. The implication of this rule is that each test must be loaded" +" with a fresh dataset and may have to do some cleanup afterwards. This is" +" usually handled by :meth:`setUp()` and :meth:`tearDown()` methods." +msgstr "" + +#: ../../writing/tests.rst:26 +msgid "" +"Try hard to make tests that run fast. If one single test needs more than " +"a few milliseconds to run, development will be slowed down or the tests " +"will not be run as often as is desirable. In some cases, tests can't be " +"fast because they need a complex data structure to work on, and this data" +" structure must be loaded every time the test runs. Keep these heavier " +"tests in a separate test suite that is run by some scheduled task, and " +"run all other tests as often as needed." +msgstr "" + +#: ../../writing/tests.rst:34 +msgid "" +"Learn your tools and learn how to run a single test or a test case. Then," +" when developing a function inside a module, run this function's tests " +"frequently, ideally automatically when you save the code." +msgstr "" + +#: ../../writing/tests.rst:38 +msgid "" +"Always run the full test suite before a coding session, and run it again " +"after. This will give you more confidence that you did not break anything" +" in the rest of the code." +msgstr "" + +#: ../../writing/tests.rst:42 +msgid "" +"It is a good idea to implement a hook that runs all tests before pushing " +"code to a shared repository." +msgstr "" + +#: ../../writing/tests.rst:45 +msgid "" +"If you are in the middle of a development session and have to interrupt " +"your work, it is a good idea to write a broken unit test about what you " +"want to develop next. When coming back to work, you will have a pointer " +"to where you were and get back on track faster." +msgstr "" + +#: ../../writing/tests.rst:50 +msgid "" +"The first step when you are debugging your code is to write a new test " +"pinpointing the bug. While it is not always possible to do, those bug " +"catching tests are among the most valuable pieces of code in your " +"project." +msgstr "" + +#: ../../writing/tests.rst:54 +msgid "" +"Use long and descriptive names for testing functions. The style guide " +"here is slightly different than that of running code, where short names " +"are often preferred. The reason is testing functions are never called " +"explicitly. ``square()`` or even ``sqr()`` is ok in running code, but in " +"testing code you would have names such as ``test_square_of_number_2()``, " +"``test_square_negative_number()``. These function names are displayed " +"when a test fails, and should be as descriptive as possible." +msgstr "" + +#: ../../writing/tests.rst:62 +msgid "" +"When something goes wrong or has to be changed, and if your code has a " +"good set of tests, you or other maintainers will rely largely on the " +"testing suite to fix the problem or modify a given behavior. Therefore " +"the testing code will be read as much as or even more than the running " +"code. A unit test whose purpose is unclear is not very helpful in this " +"case." +msgstr "" + +#: ../../writing/tests.rst:69 +msgid "" +"Another use of the testing code is as an introduction to new developers. " +"When someone will have to work on the code base, running and reading the " +"related testing code is often the best thing that they can do to start. " +"They will or should discover the hot spots, where most difficulties " +"arise, and the corner cases. If they have to add some functionality, the " +"first step should be to add a test to ensure that the new functionality " +"is not already a working path that has not been plugged into the " +"interface." +msgstr "" + +#: ../../writing/tests.rst:81 +msgid "The Basics" +msgstr "" + +#: ../../writing/tests.rst:85 +msgid "unittest" +msgstr "" + +#: ../../writing/tests.rst:87 +msgid "" +":mod:`unittest` is the batteries-included test module in the Python " +"standard library. Its API will be familiar to anyone who has used any of " +"the JUnit/nUnit/CppUnit series of tools." +msgstr "" + +#: ../../writing/tests.rst:91 +msgid "" +"Creating test cases is accomplished by subclassing " +":class:`unittest.TestCase`." +msgstr "" + +#: ../../writing/tests.rst:104 +msgid "As of Python 2.7 unittest also includes its own test discovery mechanisms." +msgstr "" + +#: ../../writing/tests.rst:106 +msgid "" +"`unittest in the standard library documentation " +"`_" +msgstr "" + +#: ../../writing/tests.rst:110 +msgid "Doctest" +msgstr "" + +#: ../../writing/tests.rst:112 +msgid "" +"The :mod:`doctest` module searches for pieces of text that look like " +"interactive Python sessions in docstrings, and then executes those " +"sessions to verify that they work exactly as shown." +msgstr "" + +#: ../../writing/tests.rst:116 +msgid "" +"Doctests have a different use case than proper unit tests: they are " +"usually less detailed and don't catch special cases or obscure regression" +" bugs. They are useful as an expressive documentation of the main use " +"cases of a module and its components. However, doctests should run " +"automatically each time the full test suite runs." +msgstr "" + +#: ../../writing/tests.rst:122 +msgid "A simple doctest in a function:" +msgstr "" + +#: ../../writing/tests.rst:141 +msgid "" +"When running this module from the command line as in ``python " +"module.py``, the doctests will run and complain if anything is not " +"behaving as described in the docstrings." +msgstr "" + +#: ../../writing/tests.rst:148 +msgid "Tools" +msgstr "" + +#: ../../writing/tests.rst:152 +msgid "py.test" +msgstr "" + +#: ../../writing/tests.rst:154 +msgid "" +"py.test is a no-boilerplate alternative to Python's standard unittest " +"module." +msgstr "" + +#: ../../writing/tests.rst:160 +msgid "" +"Despite being a fully-featured and extensible test tool, it boasts a " +"simple syntax. Creating a test suite is as easy as writing a module with " +"a couple of functions:" +msgstr "" + +#: ../../writing/tests.rst:173 +msgid "and then running the `py.test` command:" +msgstr "" + +#: ../../writing/tests.rst:195 +msgid "" +"is far less work than would be required for the equivalent functionality " +"with the unittest module!" +msgstr "" + +#: ../../writing/tests.rst:198 +msgid "`py.test `_" +msgstr "" + +#: ../../writing/tests.rst:202 +msgid "Hypothesis" +msgstr "" + +#: ../../writing/tests.rst:204 +msgid "" +"Hypothesis is a library which lets you write tests that are parameterized" +" by a source of examples. It then generates simple and comprehensible " +"examples that make your tests fail, letting you find more bugs with less " +"work." +msgstr "" + +#: ../../writing/tests.rst:212 +msgid "" +"For example, testing lists of floats will try many examples, but report " +"the minimal example of each bug (distinguished exception type and " +"location):" +msgstr "" + +#: ../../writing/tests.rst:228 +msgid "" +"Hypothesis is practical as well as very powerful and will often find bugs" +" that escaped all other forms of testing. It integrates well with " +"py.test, and has a strong focus on usability in both simple and advanced " +"scenarios." +msgstr "" + +#: ../../writing/tests.rst:232 +msgid "`hypothesis `_" +msgstr "" + +#: ../../writing/tests.rst:236 +msgid "tox" +msgstr "" + +#: ../../writing/tests.rst:238 +msgid "" +"tox is a tool for automating test environment management and testing " +"against multiple interpreter configurations." +msgstr "" + +#: ../../writing/tests.rst:245 +msgid "" +"tox allows you to configure complicated multi-parameter test matrices via" +" a simple INI-style configuration file." +msgstr "" + +#: ../../writing/tests.rst:248 +msgid "`tox `_" +msgstr "" + +#: ../../writing/tests.rst:252 +msgid "mock" +msgstr "" + +#: ../../writing/tests.rst:254 +msgid "" +":mod:`unittest.mock` is a library for testing in Python. As of Python " +"3.3, it is available in the `standard library " +"`_." +msgstr "" + +#: ../../writing/tests.rst:258 +msgid "For older versions of Python:" +msgstr "" + +#: ../../writing/tests.rst:264 +msgid "" +"It allows you to replace parts of your system under test with mock " +"objects and make assertions about how they have been used." +msgstr "" + +#: ../../writing/tests.rst:267 +msgid "For example, you can monkey-patch a method:" +msgstr "" + +#: ../../writing/tests.rst:278 +msgid "" +"To mock classes or objects in a module under test, use the ``patch`` " +"decorator. In the example below, an external search system is replaced " +"with a mock that always returns the same result (but only for the " +"duration of the test)." +msgstr "" + +#: ../../writing/tests.rst:297 +msgid "" +"Mock has many other ways with which you can configure and control its " +"behaviour." +msgstr "" + +#: ../../writing/tests.rst:299 +msgid "`mock `_" +msgstr "" + pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy